11,779 reputation
11049
bio website vyznev.net
location Helsinki, Finland
age
visits member for 3 years
seen yesterday

I'm a PhD student in biomathematics, working on stochastic individual-based models of evolution in spatially structured populations. My other interests include cryptography, programming games and puzzles, photography and graphic design.

I started programming (in AmigaBASIC) when I was 10 years old. Nowadays, I'm most comfortable using Perl, C and JavaScript. I know Java and PHP too, but I can't really say I like them. I also know some Python, but not as much as I'd like.


CC-Zero Please consider any (original) code I post to Stack Overflow and other Stack Exchange sites to be released under CC-Zero unless stated otherwise. You may do whatever you want with it and don't have to credit me in any way, although of course that would be nice.


I'm the main author and maintainer of the Stack Overflow Unofficial Patch (SOUP), a user script for browsers with GreaseMonkey-compatible user script support (Firefox, Chrome, Opera, possibly Safari) that fixes or works around a number of outstanding issues with the Stack Exchange user interface.

I tend to answer a lot more questions than I ask. Some answers I'm rather proud of:


Aug
9
comment Recover from compromised shares with Shamir Secret Sharing
+1. Of course, it's worth noting that the dealer still needs to be trusted; a malicious dealer could construct their polynomial with a non-zero constant term, thereby changing the secret (potentially to one of their choosing, if they can guess the original secret).
Jul
18
comment Is TripleDES 168bit vulnerable to Differential Cryptanalysis?
@owlstead: Agreed. Not only is it full of both factual and grammatical errors, but most of the text, or at least the more fluent parts of it, appears to be plagiarized. If this were an undergrad course assignment, I'd give it an F; since the authors appear to be grad students, and since it appears to have been published in something pretending to be a scientific journal...
Jun
4
comment Why is TLS SRP verifier based on user name?
@simbo1905: The compromised server wants to know if Alice and Bob have the same password. So, when Alice tries to log in, the server looks up Bob's authentication data $(s_{\rm Bob}, v_{\rm Bob})$ and sends Alice $s=s_{\rm Bob}$ and (in SRP-6) $B=3v_{\rm Bob}+g^b$, gets back $M_1$ and verifies that it equals $H(A,B,S)$, $S=(Av_{\rm Bob}^u)^b$. If it does, Alice has just successfully authenticated herself as Bob, which (with overwhelming likelihood) means they must have the same password $P$ and identifier $I$. Assigning each user a separate $I$ (typically, their username) plugs this hole.
May
31
comment Encryption of log files
Using a stream cipher (or a block cipher in CTR mode) would be tempting, but would be vulnerable to an attack where the attacker deliberately truncates the log file before letting your program append to it, in order to obtain multiple logs encrypted with the same keystream. Still better than just XOR with a static key, though.
May
31
comment Why is plain-hash-then-encrypt not a secure MAC?
@D.W.: I agree that these questions have substantial overlap, but it's not obvious which one(s) of them should be deemed canonical. In particular, given that this question seems to have the most thorough and highly voted answer (not that the others don't have good answers too), there's an argument to be made for closing both of the earlier questions as duplicates of this one.
May
25
comment Common password derivation function for different encryption methods
Even with Grover's algorithms, you're still looking at $2^{128}$ quantum operations, which is still damn hard, even if you assume that quantum computing becomes as easy as classical. If you assume that a 128-bit keyspace is safe against any foreseeable classical attacks (which I think most cryptographers would), then you should consider a 256-bit keyspace safe against quantum attacks too.
May
24
comment Is a Mersenne-twister cryptographically secure if I truncate the output?
This does not seem to be a real question, but rather an attempt to argue a point or to discuss the merits of a novel cryptographic primitive. As such, it is off-topic for Cryptography Stack Exchange, as described in our help center.
May
24
comment Common password derivation function for different encryption methods
However, if you need more key material simply because you need multiple keys (say, a MAC key and an encryption key, and maybe something else too), then PBKDF2+HKDF with a 256-bit hash is perfectly fine. Or you could always use SHA-512 to widen the "bottleneck" to 512 bits.
May
24
comment Common password derivation function for different encryption methods
It kind of depends on why you want that much key material. If it's because you think a 256-bit key is too short to be secure, then, indeed, you should not have a 256-bit bottleneck in your KDF. (But if you really think someone could brute-force a 256-bit keyspace, then you obviously know something the rest of us don't. Also, considering that key-stretching rarely adds more than 30 bits of entropy, where are you getting a password with over 226 bits of entropy from?)
May
24
comment Common password derivation function for different encryption methods
For some strange reason, if you ask PBKDF2 for more than one hash output block's worth of key material, it repeats the whole key-stretching process several times. This severely slows down the key derivation for legitimate users, whereas attackers typically don't suffer at all (since they only need to derive one output block to confirm their guess). PBKDF2+HKDF doesn't have that issue.
May
23
comment Which tamper-protection algorithm provides the shortest output?
... Hence, we just slapped a MAC onto any serialized data items, without any associated data; if users wanted to poke into the HTML code and replace one serialized string with another, that was fine with us, as long as we knew they couldn't pwn the server by feeding in some serialized code and telling the deserializer to overwrite a common library function with it.
May
23
comment Which tamper-protection algorithm provides the shortest output?
@D.W.: Also worth noting is that, sometimes, you might not care about replay attacks: for example, I once worked on an in-house web app framework that supported passing arbitrary serialized data structures as hidden variables. On the framework level, we did not care about replay or pick-and-mix attacks -- those, if they were an issue, would be checked for at the application level. But we did want to stop untrusted data from going into the deserialization library, since it wasn't designed with security in mind, and had "features" that allowed e.g. arbitrary code execution. ...
May
23
comment Which tamper-protection algorithm provides the shortest output?
... A convenient feature of SIV mode, in this regard, is that it can take a tuple of strings as associated data, rather than just a single string, so you don't have to worry about details like unambiguous encoding.
May
23
comment Which tamper-protection algorithm provides the shortest output?
@D.W.: Good point, although it really goes beyond algorithm choice, and into threat modelling. The general answer, with an AEAD algorithm, is to pass any extra (meta)data, which you want to tie the protected data to, into the algorithm as Associated Data. This might include e.g. a form ID, a timestamp, the user ID and any other hidden fields on the form. Note that all of those effectively become integrity-protected too: the authentication tag will only match if all of them are unchanged (although an attacker might still be able replace all of them, together, with an earlier set of values).
May
22
comment Common password derivation function for different encryption methods
+1. Also, if you might need more than 256 bits of key material, consider using PBKDF2+HKDF (i.e. use PBKDF2 to derive one hash output block's worth of bits, then feed that into the expansion stage of HKDF as the PRK input).
May
8
comment Decrypt a public encrypted message and Sign a signature, how the math is different?
@CodesInChaos: I think this could actually be a pretty good "FAQ" question, and your comment, with some embellishment (e.g. compare RSA signing with RSA encryption and DSA / ElGamal signing with ElGamal encryption), could make a good answer for it. I may try to write one later, unless someone else does it first.
May
5
comment Difference between a nonce and IV
Related, but less specific question: crypto.stackexchange.com/questions/3965/…
May
4
comment How do I produce a stream of secure random numbers from AES-Counter mode?
@owlstead: I'm not aware of any attacks for $E_K(K)$, but there's definitely an attack for, say, $E_K(D_K(0))$.
Apr
26
comment How secure would HMAC-SHA3 be?
@fgrieu: As far as I can tell, the argument is that Keccak provides this level of security when used with the generic sponge MAC construction (= prepend key to message; CSF §5.11.2), of which the inner HMAC pass can be seen as an instance. That security, in turn, is claimed to follow from the Keccak flat sponge claim (Keccak reference §1.5), which is a pretty strong claim that, loosely speaking, says that Keccak is as good as a random oracle against attacks using $\lll 2^{c/2}$ work.
Apr
25
comment Solving Vignere Encryption
@vignere_solve: OK, here's the hint: I was wrong about letter case. The correct cipher alphabet has 64 characters: AZ, az, 09, + and /. It just happens that, with this particular alphabet and key, most lowercase letters are encrypted to uppercase ones, and vice versa.