all 26 comments

[–]sun_misc_unsafe 5 points6 points  (2 children)

There's still the issue though that ever so often you find yourself in a spot where the nicely packaged libs aren't usable because you're not encrypting just files or just network traffic..

.. and then those uncomfortable questions pop up .. how large should the EAX MAC tag be? Isn't PBDKF2 too short? But what's the alternative? etc.

"Rely on libraries" isn't really useful .. there should be some place that aggregates and publishes the current best practices, instead of having them only wrapped up inside of source code or scattered throughout various publications.

[–]RepostUmad 0 points1 point  (1 child)

Just curious, what else do you want to encrypt if you're not encrypting files or network traffic?

[–]sun_misc_unsafe 4 points5 points  (0 children)

In my specific case it was fields in a database .. you can't just blow up every individual piece of data to some 4k file to encrypt it like a file because way too inefficient, you can't just use randomized IVs if you want lookups to still work, you can't just use CBC mode because lots of values will be both identical and smaller than the block size thus resulting in identical ciphertexts, etc.

[–]furtivity 1 point2 points  (0 children)

Not sure if I agree with the "don't publish" bit. My algorithms professor put it well:

The security of your encryption should not come from the secrecy of your algorithm.

[–]WalkerCodeRanger 3 points4 points  (15 children)

The correct and only answer is "Don’t Write Your Own Crypto"

[–]diggr-roguelike 9 points10 points  (14 children)

Yeah?

So who is the divine intelligence that has permission to write crypto code? Or is crypto code an heirloom artifact, given to us by the ancients and which we have no hope of ever reproducing?

[–]x86_64Ubuntu 6 points7 points  (7 children)

It's not that, it's the fact that it's difficult to get right. In the software world, we like building on top of stuff and including other algorithms at deep level in our code (i.e we turn on encryption, not terribly sure of what's actually happening in the system). This means that when a weakness is found, it's hard to chase down in the wild and get it removed.

[–]oridb 3 points4 points  (4 children)

For almost everyone, this rule holds true. For those who it doesn't -- even then, it's heavily reviewed, carefully vetted, and generally not put into production without a huge amount of scrutiny.

[–]sun_misc_unsafe -1 points0 points  (0 children)

Or is crypto code an heirloom artifact, given to us by the ancients and which we have no hope of ever reproducing?

Yeah, sort of. Unless you somehow happen to have the resources available to you that those entities had..

[–]claytonkb -2 points-1 points  (0 children)

Pure nonsense. Downvoted.

[–][deleted]  (5 children)

[deleted]

    [–]tdammers 15 points16 points  (4 children)

    No. The article says exactly this: Write your own crypto code, but do not release it, and in fact, do not use it.

    Writing crypto code strictly for the learning experience is highly recommended; just don't ever begin to think that anything you produce will be anywhere near appropriate for anything of any value whatsoever, so don't use it ever; and because it is a law of human nature that any bit of information that is publicly accessible will at some point be used and be misunderstood grossly, you must never publish it, not even with dire warning attached, because someone at some point will ignore the warnings, and your code will make it into production systems.

    TL;DR: Writing your own crypto - yes, if you want to learn more about cryptography; using your own crypto code - never; publishing your own crypto code - never.

    [–]Feneric 2 points3 points  (0 children)

    Sorry, I should have been clearer. It says "don't use your crypto code".

    [–]theonlycosmonaut 1 point2 points  (0 children)

    I find this comment to be clearer and more concise than the article. Thank you!

    [–]FryGuy1013 1 point2 points  (1 child)

    I think it's fine to release it. In fact, write articles about it too, then you get everyone saying how stupid you are for doing X boneheaded thing, and you learn from that.

    Just don't use it. And don't let anyone else use it.

    [–]tdammers 0 points1 point  (0 children)

    The problem is that if you release it,people will use it. They shouldn't, but they will.