2,434 reputation
2617
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 3 years, 9 months
seen 18 hours ago

Nov
15
comment When You Have Both Options, When Functional and When OOP?
I prefer simple immutable types (a more functional style) for simple data and complex algorithms, whereas for complex data with may connections I prefer OOP. But since the opposite of function is imperative, not OOP it's often possible to have mostly functional algorithms operate on complex mutable objects.
Nov
15
comment Why does the modifier access for the properties need to be public with Unity?
@Telastyn 1) Manual DI should be possible as well. An IoC container is just a convenience. Preferably the your class doesn't even know there is such thing as IoC containers or even worse which one you're using. 2) The IoC container is external to the object, so it should go through the public API. Either calling a public constructor, or setting a public property.
Nov
14
comment Generating a Nakagami Random Variable
In the worst case one can always use an approximation of the inverse CDF combining it with a rejection function to arrive at the precise distribution.
Nov
13
comment Signing redistributed files
Depends on the license of the library you're using.
Nov
13
comment How to model an address type in DDD?
Certainly seems like the cleanest solution, but since addresses are typically used only once, denormalizing them into the user-address connection is probably the most practical approach in many situations.
Nov
13
comment So Singletons are bad, then what?
There is one more condition to be the bad singleton pattern: Mutability or access to external mutable state. For example making something like AsciiEncoding a singleton with a static accessor would be fine since any possible instance of it would be equivalent.
Nov
13
comment Updating password hashing without forcing a new password for existing users
if H1 is really terrible this won't be secure. Being terrible in this context is mostly about losing a lot of entropy from the input. Even MD4 and MD5 are nearly perfect in this regard, so this approach is only insecure for some homebrew hashes or hashes with really short output (below 80 bits).
Nov
13
comment Why not expose a primary key
hm? Obviously it requires SSL, but that's the case no matter how you authenticate and authorize. Over SSL an attacker can't learn the token (just like they can't learn cookies) and it also prevents replay attacks. The main downside of this approach is that you can't revoke access for individual users, so I prefer using it only for immutable resources. Revoking access to immutable resources is meaningless since an attacker could simply store a local copy.
Nov
13
comment Why not expose a primary key
Unguessable urls (e.g. containing a cryptographically random 128 bit token) are one form of proper authorization.
Nov
12
comment What is the advantage to using a factor of 1024 instead of 1000 for disk size units?
In some low level corners binary units are useful (for example disk sector size, RAM pages etc.). But for high level values directed at end users, like disk or file sizes, there is little reason to use binary prefixes.
Nov
10
comment Updating password hashing without forcing a new password for existing users
Password hashing has barely evolved over the last 15 years. Bcrypt has been published in 1999 and is still of of the recommended hashes. Only one significant improvement has happened since then: sequentially memory hard hashes, pioneered by scrypt.
Nov
10
comment Updating password hashing without forcing a new password for existing users
The problem with this technique is that for accounts don't log in, you can't update the hashes. In my experience most users won't login for years if ever (unless you delete inactive users). Your abstraction doesn't really work either, since it doesn't account for salts. The standard abstraction is having two functions, one for verification and one for creation.
Nov
4
comment Is it reasonable to null guard every single dereferenced pointer?
I'd throw at points where invalid input can be passed in through a public API (in this case in the constructor) and assert for internal consistency checks (I know it'll never be null because I already checked in the constructor).
Nov
4
comment Since Garbage Collection is non-deterministic, why isn't it used for secure random number generation?
@Schilcote Even without specialized RNG instructions (Intel's RDRAND and RDSEED) a computer isn't completely deterministic. Some timings aren't completely specified and can depend on external factors like temperature.
Nov
1
comment Dependency injection: At what point am I allowed to create a new object?
I recommend IoC for services and policies. For model or helper classes I'd simply use new. Of course there are a few entry points where you need to call into the IoC container, but there shouldn't be many. Typically you configure the IoC once and then ask for one class to be resolved per request. In the case of MVC that's typically the controller.
Oct
25
comment Regarding little endian and big endian conversion
Usually you don't need to convert endinaness of integers, you need to read them from the byte sequence using the desired endianness.
Oct
21
comment I need a public cryptography system that works on small keys
Unfortunately the signature size is 3x the security level with EC-Schnorr and 4x the security level with ECDSA. Even with the rather dubious security level of 80 bits, that means 20 byte public/private keys and 40 byte signatures. There are some schemes with smaller signatures, e.g. BLS at 2x security level and some really exotic ones with less, but finding good implementations of those will be tricky.
Oct
21
comment Programmers' concerns about export restrictions from the United States
I'm pretty sure that you still need to file all that crypto export stuff if you're merely using crypto APIs.
Oct
14
comment Why does the instruction “do” require a “while”?
The two part do...while only exists to check after the loop. For checking at the beginning and infinite loops c doesn't require a pair either. There is no difference as far as this question is concerned between python's while True: and c's while(true)
Oct
14
comment Why does the instruction “do” require a “while”?
your python example doesn't match the purpose of do{}while(). The idea behind do{}while() is checking the condition at the end of the loop, not at the beginning.