On Choosing Encryption ...
A crafty owl hooted this query into my ear: "How do developers decide which encryption they are going to use? If you do a search for 'blowfish' on freshmeat.net it turns up 14 hits. Blowfish isn't even an AES candidate. Counterpane's submission to the AES contest -- Twofish -- turns up a meager five hits, only two of which are really applications. Serpent, another strong AES candidate isn't used by any applications listed on freshmeat. OpenBSD can use Blowfish passwords. Not Serpent or Twofish but Blowfish. Why? How do the developers decide which to use? Do they actually evaluate the different candidates? On what criteria are the decisions made? Security? Speed? Ease of implementation? Is it based simply on what everyone else is doing or which algorithm's author is more well known?"
First, I have to say that choosing Blowfish, Twofish, IDEA, 3DES, Serpent, Rijndael or something else, is not the first, nor the most important question, in a cryptograhpical product. There's *much* more to cryptography than choosing a symmetric cypher, and it's very easy to use a great algorithm in a broken way. As the saying goes, security is a process, not a product. And within a product, it's a protocol, not an algorithm. You need to design the entire way that the various clients and servers will talk, to be secure: how to choose and agree on the keys, how and when to rotate them or generate new ones, where to get your crypto-strong random seeds, using the right cyphering modes for the situation (ECB is not usually a good idea), whether to use a block or stream cypher, whether and how to interface to public key crypto, how to fend off replay attacks, and so on and so forth, the whole protocol. Only when you've figured out all this stuff, does it start to make sense to evaluate individual cyphers, for speed and perceived security. There, again, the general idea for safety is to go for something that has withstood serious analysis for a long time. I wouldn't count out Blowfish just because Twofish is its successor; Twofish looks very impressive, but has been around for a much shorter time. Right now I'd still trust Blowfish or 3DES better.
This just isn't any kind of an advantage. All the gains that you list for having a slow key schedule can be gained with a few extra key bits. If you really can't get a few extra key bits for some reason, it's no problem to artifically slow the key schedule; just hash the key a few thousand times. With a construction like abreast Davis-Meyer, you can even use the block cipher to do the hashing. Fast keyschedules are a Good Thing and there's nothing to be said for deliberately slowing them down.
There may be resasons for choosing Blowfish rather than Twofish, but this isn't one of them. Actually, I think there are only three:
* you don't trust any cipher less than five years old
* you have to have a 64-bit block, despite the advantages of a 128-bit block
* you want something easier to code
--
Xenu loves you!
None of the AES "top five" have fallen to an attack, even a wholly impractical attack, that breaks all rounds of the cipher. All of them break if you reduce them to few enough rounds. I don't know why you name MARS as subject to these attacks in particular, though "MARS attacks!" is a great title for a paper; the two that look shakiest at the moment are RC6 and Rijndael (though note that all of the designers are still happy with their current designs).
Oh, and fast implementations of Serpent take up more FPGA area than you might expect - in fact, more than RC6, despite the multiply in RC6. This is because it makes sense to unroll the loops eight times to hit the "sweet spot". However, it's perfectly fast in software - not quite as blinding as the other AES candidates, but plenty fast enough, especially on architectures other than the register-poor x86.
MacGuffin was proposed by Matt Blaze and Bruce Schneier; it was never meant for serious use, but to encourage analysis of a new structure, the GUFN (generalised unbalanced Feistel network).
--
Xenu loves you!
I don't think this issue is entirely relevant, although I agree it is important.
For many applications they simply don't have to interoperate with others. For instance, one of the Blowfish apps is a GNOME password manager. They could pick anything they wanted to. But they picked Blowfish over Twofish and Serpent. Why? Same deal with OpenBSD's choice of Blowfish. They don't "interoperate" with anyone in that scenario.
If anything, your argument makes the widespread use of Blowfish even stranger, since it isn't even under consideration as an AES candidate its widespread adoption is unlikely.
The people who make decisions on important things like this don't know enough about what's going on. Judges make laws that are completely stoooooopid because they think the laws of the real world still hold relevance on the internet. Many people believe that if a cipher has been around for 5-10 years without any major attacks, it's safe. This isn't true. If you look at the AES finalists, they all employ 3 fundamental properties: a) input/output XORing b) a linear operation in each round c) a differential operation (S-box) in each round Because of the 3 biggest attacks on ciphers: 1) key recovery (basically knowing the input and output to the first and last rounds without even knowing the key is not good, so we XOR the input and output) 2) linear cryptoanalysis (guess what kinds of operations this is useful against? :) ) 3) differential cryptoanalysis (guess what kinds of operations this is useful against? :) ) Many of the ciphers used in BSD/Linux aren't using this for two reasons: 1) Script Kiddies can't write the code to attack these ciphers nor employ the HW horsepower to do it. 2) The AES is coming. When the standard is announced (not barred IP problems overseas), you can bet freahmeat and replay will have C/ASM/Java source code for many platforms. I hope this answers a lot of your questions. BlowFish (or even flipping the bits of you data!) is enough to keep the lazy hacker from getting at your system. Anything beyond that and you're investing efforts to keep 'advanced' hackers/corps away. Please feel free to drop me line at work jean-luc.cooke@entrust.com. I'm a cryptographer who's implementing the AES here at Entrust Tech.
Right now, the primary criteria for AES candidates is security. After that, they are evaluated based on implematation issues (how scalable is it, will it run in a smart-card up to a mainframe, how easy is the code to implement, etc). But, those other issues are irrelevant if the algorithm has a hole, so that's what they are looking for first.
...phil
...phil
"For a list of the ways which technology has failed to improve our quality of life, press 3."
The first telephone ever created was totally useless, and the second was only barely better.
The usefullness of any communication device, whether encryption or telephones, is proportional to the square of the use.
Serpent, another strong AES candidate isn't used by any applications listed on freshmeat.
Serpent is available in the internation version of the linux kernel, as is blowfish, IDEA and others.
Great for loopback encrypted filesystems.
Maybe the kernel isn't an app. but serpent is there at least.
Try kerneli.org.
Happily the gap between practice and proofs seems to be closing. At least, OAEP has made its way into the PKCS #1 standard, and maybe from there it will be implemented. OAEP is pretty efficient - two hashes and two XORs on top of yer basic
RSA operation.
In fact, if you are willing to treat hash functions as "random oracles" (a big if which could be a thread in itself), then it seems that you can get quite efficient, provably secure methods to do lots of crypto. It's just a question of knowing about it. Something which having OAEP in a widely-used standard might help.
Of course, what drove its adoption as part of the standard was the fact that the old standard was broken by Bleichenbacher at Crypto '98. Sad as it may seem, no one in the "wider" community seems to pay attention until someone comes up with a spectacular attack which the provably secure systems seem to resist. I'm sure there are some people of people busy fixing their old ISO-9796 signature compliant implementations, too...
With luck, though, the IEEE 1363 standard for public-key crypto will start moving that segment of crypto towards provably secure methods. (see page at http://www.manta.ieee.org/groups/1363/ ). No clue when this is going to hit symmetric crypto -- anyone have a guess?
Even a good crypto algorithm won't protect you from a number of possible mistakes (failure to wipe buffers, bad pseudo-RNG, bad method of selecting keys, etc.). Availability of the encryption method as a library under a license that will permit its use in a free software project would be an important factor. With some projects, reimplementation from scratch is an option. For others, it isn't all that desirable.
The net will not be what we demand, but what we make it. Build it well.
They're both pretty fast already, and improving hardware technology can only make them faster. Why improve on a good thing, particularly when you're opening yourself up to the potential for errors in an untested algorithm?
It's rare that you're presented with a knob whose only two positions are Make History and Flee Your Glorious Destiny.
Well, not quite irrelevant. It should be one that has been bounced on for a few years by serious cryptanalysts with no serious (i.e. non-academic) weaknesses found.
Triple DES is *probably* strong and has stood years of abuse.
RC4 is also thought to be strong, and is in the public domain whether RSA like it or not. It has the advantage that it can be coded in about 15 lines.
Blowfish is also probably strong. So are *all* the AES candidates. I like Rijndael with 18 rounds and Twofish (I'm betting on Twofish becoming the standard). Serpent is also nice.
But all this is irrelevant. *All* the algorithms I have mentioned are strong against any meaningful attack, and unless you are encrypting gigabytes they all perform well enough on modern hardware.
None of this matters if your implementation sucks. What really matters are things like key generation, key management, ensuring keys are never stored anywhere inappropriate (like on a disk - how are you going to control swapping?), enforcing strong passphrases (this is very hard). Then there's system security. What if someone patches a binary to email them the key during encryption?
Basically, spend your time hardening the implementation. That's where you will be attacked.
Also, don't code them yourself (except for fun) - there are a number of free (usually public domain) implementations of these algorithms. These have been peer-reviewed and tested. The chance of blowing the strength of the algorithm with a stupid coding error is too high to risk.
In the deep past, it was DES. Everyone knew it, the code was readily available, the algorithm very heavily analyzed, and it was a near universal standard. In the future, it will be the AES winner, as the code will be readily available, the algorithm very heavily analyzed, and a near universal standard.
Currently, it has been more difficult. There was no clear standard when it became clear that DES's useful lifetime was over. People tended to use algorithms that were generally available and out for a while (therefore heavily analyzed), or which they have IP rights for. IDEA, 3DES, Blowfish, RC4, RC5, etc. 3DES and Blowfish being the most popular for open source and free projects, as they are both free of IP entanglements.
The AES process is relatively new. The five finalists have only been out there for a couple of years, and only been finalists for about a year and a half. Fortunatly, with the third AES conference behind us, and the winner due to be selected and announced within a couple of months, we will be returning to the days of DES, a common standard which everyone is free to use, with lots of implementations available.
Also, with the AES finalists, the IP entanglements weren't entirely clear. TwoFish and Rijndael were unentangled from the start, but Serpent had an initial patent filed, but then let the process lapse (so it is now unentangled). MARS and RC6 still have significant entanglements. The winner, of course, will become entanglement free (barring the IP attack scenario), but until then, chosing an AES candidate wasn't any better or worse then picking an older, available algorithm from an IP viewpoint or even from a security viewpoint (as they weren't very heavily analyzed by those other than the developers during the first round, as there were some 30 odd first round candidates).
Fortunatly, the AES winner will probably return us to the DES world: A trusted, entanglement free, well understood, secure algorithm.
Nicholas C Weaver
nweaver@cs.berkeley.edu
Test your net with Netalyzr
There's two major points to make.
1) No one knows how to show that any useful block cipher is "strong." The best we can do is show that a cipher resists some of the attacks which worked on other ciphers. This doesn't say much about possible future attacks.
Two major responses to this. The first says to use only block ciphers which have received lots of analysis. The theory is that lots of eyes will pick out flaws. By this metric, DES is the best cipher out there, and 3DES is the way you should use it.
Beyond that it's a judgement call. For instance : Blowfish vs. the five AES candidates. Blowfish has been around longer, but nearly every block cipher expert in the world has been hammering on the AES candidates. Which do you pick?
(personally, I would go for the final AES)
The other major response, expounded by Terry Ritter, is that you should change ciphers often and use multiple "stacks" of ciphers. The theory is that if you use a lot of ciphers for a short time, you make it harder for an adversary to concentrate his efforts on any one of them. This seems to be a minority opinion (at least on sci.crypt), but it should be considered.
2) In real life, most systems die a horrible death NOT because they used a weak block cipher, but
because they took a very good block cipher and used it in a stupid way.
In my opinion, most of the concern over the strength of this or that block cipher is blown out of proportion. YES it is important, but even more important is analysis of the protocol in which you're going to use the cipher. Just because you use 3DES does not mean you're "secure" (can you even define "security" in your application, to start with?)
I should mention here that I'm not a block cipher expert, and I don't find them easy to think about. I prefer public-key crypto (but I'm not an expert there either
You can try to work with the first point by thinking about who your adversaries might be. Do they have access to secret research on cryptanalysis which is likely to be better than what's publically known? Do they know the public literature better than you do? How valuable is that data you're protecting, and what happens if your protocol fails? (do you know how it could fail?) The more valuable the data, the more paranoid you should be about your adversaries, and the more careful you need to be in your choice of primitives.
In any case, design your protocol with a generic "block cipher" in it, so you can swap out whatever you have and put in something else later. This may entail adding a negotiation step so both parties use the same cipher -- make **sure** that this is authenticated somehow! (or you'll end up like SSL 2.0)
and then start worrying about the bigger protocol issues...
Dilbert: "You mean it does nothing useful and isn't your fault?"
Vendor: "Is there someone less knowledgeable I can talk to?"
Open Source. Closed Minds. We are Slashdot.
Triple DES is used because affordable machines can brute-force DES in seconds to minutes. Triple DES effectively has twice the keylength of DES, 112 bits instead of 56 bits. This means triple DES is about 65 quadrillion times more expensive than DES to build a brute-force machine for, putting it beyond the budget of any known earthly agency such as the NSA. The only reason to go further is if you are trying to defend against the galactic government or something. :) Basically, the chances are very good that anything which cracks 3DES will crack 10DES too, to the extra compute effort isn't buying you anything obvious.
Triple encryption isn't altogether silly if done right -- it is insurance against some disastrous hole being found in any single one of the algorithms used. But disastrous holes in codes like DES which have had decades of attack are seen as rare. Basically, other attacks are much more likely to be your undoing, and triple encryption won't address them, so the win isn't seen as great.
Linux distros tend not to include much crypto because Uncle Sam has been insisting for a long time that national security requires that the national network be insecure: Distributing crypto from the US could get you jailed. Debian has offshore sites which distribute the crypto part of their distribution. (non-us.debian.org)
Crypt shouldn't be hard to find. There used to be a 'crypt user's workbench' or some such with tuned implementations &tc. Very good attacks on it are now known, so there's not much interest in it.
The 'fish' doesn't mean anything in particular, it has just become a habit to name crypto algorithms after animals -- pike, serpent, &tc.
A large keyspace is necessary but not sufficient to ensure security. It is easy to design a weak cipher with an arbitrarily large keyspace. Think of a simple polyalphabetic substitution cipher with N alphabets. Increasing the number of alphabets adds to the size of the keyspace but it is still vulnerable to pencil and paper attacks by decomposing it back into N simple substitution ciphers.
Mea navis aericumbens anguillis abundat
A more serious example is the MD5 hashing algorithm. Hans Dobbertin's work from the last couple of years looks like it's possible to generate hash collisions, at least under some conditions that can be realistic, so everybody's having to move to SHA-1 hashes for anything new. It's unfortunate - MD5 was fast, and the 128-bit output was a useful size for use as 128-bit keys. On the other hand, there are applications where a birthday-attack collision means you only need to try about 2**64 attempts instead of 2**128, so for those applications, MD5's 128 bits wasn't enough, because it's becoming possible to brute-force things of that size, while a similar attack on SHA1 would require 2**80 tries, which is a significantly larger number - and that's more important than the relative speed differences between SHA1 and MD5.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
There are several issues here: peer review, architecture, algorithm and implementation.
Peer Review: At each step in the process (architecture, algorithm, and implementation), you should publish your ideas for criticism by experts. slashdot, Advogato, the Cypherpunks mailing list, sci.crypt, and the Crypto++ mailing list might (or might not) be good places to find such people.
Architecture: You should do a public key architecture where every participant has a public/private key pair and the public keys are used to sign and encrypt symmetric keys that are then used for encryption and authentication of messages. There are three feasible architectures for public key distribution. You have to choose one based upon your threat model. Almost all realistic threat models should be handled using the first option: "opportunistic public key distribution". If you don't have a threat model in mind at all then you might as well use the first option. If you do have a threat model which precludes using the first option then I'd like to hear about it -- you must be doing something very interesting indeed.
Algorithm: You probably just want Triple-DES and RSA (after September of this year, when RSA becomes free of patents) or else Triple-DES and Diffie-Hellman. It should be easy to switch to a different symmetric cipher later after the new ones have been peer-reviewed and tried by fire, but for starters you want the old standbys that have already withstood the test of time. They will be fast enough for you at first and if you need more speed later you can switch.
Implementation: Your first choice should be to use an extant implementation. Don't try to implement it yourself no matter how simple it looks. Satan's Computer is deceptively subtle to people who are used to hacking Murphy's Computer.
I prefer Wei Dai's Crypto++ library, but that is because I'm doing complex non-standard crypto tricks. If you just want simple "encrypt/authenticate a stream" functionality then use a TLS implementation like OpenSSL. By the way, if anyone wants to make Python wrappers for Crypto++ (possibly with the aid of Swig) then I would love to hear about it!
Okay that's my advice. Specific pitfalls to avoid are: skipping peer-review, trying to design a generalized perfect public key architecture to handle all possible threat models, using a newfangled or non-standard algorithm ("In open source hackery, newfangled is good. In crypto, not."), and implementing it yourself instead of using a library.
Please direct all flames and accolades to: zooko@schowto.mad-scientist.com
Blowfish is used in a lot of software implementations because it's a well-designed, trusted algorithm. It's been out for a number of years, and the best minds in the field have tried to break it-- and come up with next to nothing.
It's also well-suited to software implementation: it uses operations on 8-bit bytes, which are easy to write in C and assembly. As well, it both offers a larger key size than DES and runs more quickly. OpenBSD probably uses Blowfish passwords for at least one of these reasons.
RC6, Serpent, Twofish, Rijndael, Mars-- they probably aren't bad algorithms, really (some academic attacks against Mars and RC6 aside). The problem is that they're all so new that programmers and cryptographers are somewhat wary. After all, Magenta and FROG were also candidate algorithms, and they were broken within weeks-- and not just as academic attacks, either.
Choosing an algorithm is not the cut-and-dry process many people would think. An ssh server serving thousands of simultaneous clients, for example, would NOT do well to use software implementations of Serpent, which is one of the slowest AES candidates in software. But if you're looking at using an algorithm in an FPGA design with limited space, Serpent may be a good choice-- it's small and FAST in hardware.
Basing one's choice of ciphers solely on the reputation of the author is not a good idea. Ever heard of MacGuffin? Schneier designed it, Rijmen and Preneel came up with an attack on it.
Really, a good software engineer will choose the cipher based upon the needs of the system (speed, security, size, and external conditions). If a cipher meets the proper criteria, it will be used. If not, it doesn't matter what claims to fame the cipher's designer has-- it shouldn't be used.
FEAL is in fact the ubiquitous whipping boy of cryptanalysis. I don't have the references in front of me, but Schneier describes a series of conferences in which people broke FEAL variants with more and more rounds in shorter and shorter times. I think FEAL is the cipher that Adi Shamir published a break of one variant of the day after it was presented.
Schneiers "Self-Study Course In Block-Cipher Cryptanalysis" mentions that any time a novel CA method is proposed, it should be tested by first trying it on FEAL.
Sure, you can laugh at the dumb saps who invented it--except that they were highly respected mathematicians with decades of total experience in cryptography. Sort of a reality check for those of us who look at cipher designs and say "Hey, I could do that."
spawn_of_yog_sothoth
Jeff beat me to it
OpenBSD can use Blowfish passwords. Not Serpent or Twofish but Blowfish. Why?
Password checking for user authentication is performed in software on a general-purpose computer. Brute-force password cracking can be carried out on specialized hardware. Algorithms that run much faster in hardware than in software are bad choices for password hashing.
The design of Blowfish makes it difficult to speed up in hardware. Twofish and Serpent, on the other hand, were designed for fast hardware implementation. Blowfish is also more scalable, which lets you keep up with Moore's Law.
A paper (PostScript format) on OpenBSD's rationale for choosing Blowfish can be found here. A short presentation is here.
------
------
You are in a twisty little maze of open source licenses, all different.
...you forgot "loses laptops holding classified nuclear weapons data."
Have a nice day.
--
Simon.
Sure, but probably not by as much as one might imagine, as cryptographic algorithms can have unexpected algebraic properties that can act so as to confound security. We know that DES has just such a propertly - doubleDES (which should have a complexity of keylength112) is much weaker than expected, which is why triple-des is used instead.
Cryptographers tend to view even small defects in crypto-algorithms as real problems, as those defects might be manifestations of larger, as yet undiscovered, flaws. So, dectuple-DES is quite a bit more secure than single or triple-DES, but it might well not be worth the trouble.
Multiplying-up DES in particular is a (time) expensive business. DES was designed to be implemented in hardware, so even a single software DEScrypt is expensive, and thus compounding DES with itself makes for a very very slow cipher when implemented in software.
>Does the above extent to any crypto alg? Triple blowfish? Quintuple IDEA?
Yes, theoretically, and so does the suspiction/expectation of unforeen algebraic properties that make doing so suboptimal.
>What about plaintext -> 3DES -> blowfish -> serpent? Do I gain a lot/anything by doing this?
Complicated 'though this is, it has the advantage that there's lower liklihood of the weirdo-algebra problem described above. It is, however, severe overkill.
Still, using multi-cyphers or multi-iterations is a poor substitute for having a decent cipher to begin with. If you're concerned that your chosen cipher has too small a key, use a cipher with a bigger key. If you're concerned that your chosen cipher is algorithmically flawed, use a cipher over which you have more confidence, rather than simply combining it with itself or others.
## W.Finlay McWalter ## http://www.mcwalter.org ##
The choice for what algorithm to use depends on a number of factors%2C and in my experience, it certainly helps to understand where it is going to be deployed (in hardware, small device like a Palm or a general purpose computer) and what is going to be protected (passwords, documents, streaming media).
As a great example, Blowfish is a mighty fine algorithm, but the key schedule setup takes the equivalent time of encrypting about 5k of data. If you're going to be encrypting lots of small things with different keys then Blowfish probably isn't all that suitable. Blowfish's key schedule arrays are quite large, so in devices with limited memory (like the Palm) it isn't suitable.
Twofish on the other hand has been designed to overcome a number of those limitations (pretty much because of the AES requirements).
So, understand what problems the alrithms were designed to solve, and find one that matches yours.
As has been stated many times, encrypting the data is only one link in the chain. If your key generation or exchange is weak, then you may as well not bother encrypting at all.
However, I beg to differ that no apps on Freshmeat use Serpent or other newer encryption techniques. The International Kernel Patches include Twofish, Serpent and many other newer algorithms.
(The source for some cool-looking Elliptic Curve algorithms is out and about, too, on many crypto sites.)
As for not having been battered "enough", the AES algorithms have gone through more than a little stress-testing. Sure, it's not the same as a million eyeballs and a million more skript-kiddies, but it's not feather-weight, either. Elliptic Curves have been moderately stress-tested, too, and have proved resiliant.
HOWEVER, stress-testing is NOT the same as mathematically proving. The rigors of proof don't depend on case-by-case study, but on the logic itself. Stress-testing is all fine and dandy, but it can only tell you about the exact case being looked at, under the exact conditions the looking was done. An algorithm that depends on such testing could ALWAYS be broken tomorrow, no matter how much prior testing it's had. As such, the testing has no credibility in the "formal" sense, but is merely indicitive of the real strength.
IMHO, the habits of the mainframe & Old IBM age MUST be kicked, if cryptography (as it exists) is to survive, when the Dinosaurs it is copying are either dying, dead or fossilised.
Survival, in a fast-paced industry, is not about "playing safe", or cloning the has-beens. It's about being new and creative. Scared to move too quickly with algorithms? Use dynamically-loaded encryption modules! Being cautious CAN include charging ahead, when the greatest enemy (Old Age) is cutting down everything behind you.
Given the choice of the Grim Reaper or a Skript Kiddie, I'd rather tackle the worst some pimply 16-yr-old can throw at my code. Dead Code, however good, is still dead, and isn't going anywhere.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
Apparently you are using ROT26, which I haven't seen before either. It doesn't really stop me from understanding it though.
If tits were wings it'd be flying around.
> I would suggest Rot13.
Actually, this is a bit outdated. All the standards today use something called "Triple-Rot13", which can be used in both the EDE (encrypt-decrypt-encrypt) and EEE (encrypt-encrypt-encrypt) mode. This provides twice the key length that Rot13 provides.
(Note that Double-Rot13 can be broken in about the same time as Rot13 using a meet-in-the-middle attack if you have enough memory)
Donny
Wrong. A simple substitution cipher has a keyspace equal to 26!, or about 88 bits.
Mea navis aericumbens anguillis abundat
As for why Twofish is not yet widely used -- it's a new cipher. Only two years old. Most of the programs you cite as using Blowfish pre-date Twofish, and it is only recently that I would trust Twofish (after every reputable cipher designer in the world has had two years of trying to crack Twofish). I can't say the same about Serpent, BTW, various AES commentators have nasty things to say about it (mostly that it needs more rounds to ensure proper bit diffusion, which would erase its speed advantage). About all that's been said bad about Twofish is that it is rather klunky and ugly compared to the more elegant ciphers in the AES contest (but a secure, fast klunky!).
Disclaimer -- I did the Twofish module for Python... probably am biased :-).
-E
Send mail here if you want to reach me.
I do hope you know that while blowfish is an encryption algorithm, SSL is a protocol that negotiates end-to-end encryption? Perhaps even using blowfish as the algorithm? Please compare apples to apples. Blowfish files sent over http are not generally more or less secure than that same file sent via SSL (for example, https). The difference comes in key exchange, control and lifetime, which changes the effort needed to attack the ciphertext.
The hard part of crypto is not choosing or even inplementing the algorithm, its setting up the security boundaries, deploying the algorithm correctly, and proper key management. The most secure algorithm can be destroyed by wonky random number generators, insecure key storage, improper key lifetimes, swap files or temp files that keep plaintext copies, etc... Choosing the algorithm should be almost an afterthought, as the system design is vastly more important.
I should note that I am not a professional cryptographer, just an interested amateur who has deployed a few simple cryptosystems.
-- JHod, weirdness for hire
There may be a misunderstanding in terminology. A monoalphabetic substitution cipher, assuming a 26 letter alphabet with a randomly chosen 26 letter key, has a keyspace equal to log2(26!) bits, or about 88 bits. A Caesar cipher (c = (p + k) modulo 26) has a much smaller keyspace, log2(26) bits, or about 4.7 bits. See the lecture notes from Prof. Schneider's Introduction to Cryptography for a longer explanation.
Mea navis aericumbens anguillis abundat
Of course, it's easy to do a stream cipher wrong, and you must change your key for each message transmitted in order to prevent known-plaintext attacks. (That is why most stream ciphers require an intitialization vector, which is basically a random part of the key used to ensure that the same key isn't used for two encipherments). You're much better off using something like RC4 where that kind of stuff has already been thought of and taken care of, or using a cipher feedback mode for a block cipher, which basically uses the block cipher as the bitstream generator. See Bruce Schneier's "Applied Cryptography" for more info.
_E
Send mail here if you want to reach me.
I'm surprised that more people aren't using Skipjack. The algorithm is relatively simple and doesn't need much memory. I've read that it has been approved for the protection of SECRET information in the Defense Messaging System (DMS) by the NSA. As far as I know, this is the only public algorithm that has received the NSA's approval for the protection of classified information.
Mea navis aericumbens anguillis abundat
A stream cipher could be considered a "pseudo one-time pad", in that a shorter shared key, instead of being the keypad itself, is used to produce a pseudo-random keypad on both ends (which will be identical if the seeds are identical). The key is basically the seed to a cryptographic-quality PRNG in this case. This is a very tricky thing to get right, and most "pseudo one-time pads" are cracked within minutes of being released. Use RC4 or a block cipher feedback mode if you need a stream cipher, don't try to do this yourself at home.
-E
Send mail here if you want to reach me.
Did you create that leisuretown.com thing? It is one of the most sarcastic things I've ever read. If you created it on company time, it's even better.
If anyone has 30-45 minutes to waste like I did, go read it.
-Barry
There are no magic bullets. Whether you pick a complete cryptosystem or build your own system from components, you're still going to have to exercise due dilligence.
-E
Send mail here if you want to reach me.
I'm an InfoSec consultant IRL, but this is not professional advice. (And soon I'll be a full-time paid PGP hacker. Yay. )
:)
:) I wouldn't use it in a production system, but when it comes to noodling around with novel crypto (to quote Enoch Root), GOST is my favorite.
There are literally dozens of perfectly good ciphers out there. Blowfish, 3DES, Twofish, IDEA, RC2, RC4, SEAL... the list goes on and on and on.
No two ciphers are exactly identical. Cipher selection is based on these minute tradeoffs between ciphers. For instance, 3DES is solid as a rock but is quite slow. I wouldn't use 3DES to encrypt a high-bandwidth realtime communications link, obviously, although I would readily use it to encrypt a 100k file on a disk.
Blowfish is very fast, but key setup is slow--so I wouldn't use it in an environment where keys would be changed frequently.
IDEA is strong and fast, and is well-suited in a whole range of endeavors. It's also encumbered by patent, though, and some of my clients don't want to shell out money to Ascom-Tech A.G..
... In the final analysis, cipher selection is dictated more by secondary factors than by cipher security. There are so many strong ciphers out there that we can engage in personal preference and pay attention to "other details", like performance. It's pretty simple stuff, really. I have a harder time selecting a mode for a cipher than I do selecting a cipher.
My own personal fave cipher is GOST, mainly because you get retro-cool points for using it.
Most applications are still using triple-DES (3DES) because it's been around so long and analyzed thouroghly. This doesn't mean it's the most secure or has the best performance, but lots of developers just want a "proven" technology.
Twofish looks like it's done pretty well against the competing ciphers, but my guess is a new cipher will only catch on if it's widely deployed. For example, if Netscape and IE both support Twofish for secure websites and Web Devlopers start using it, then it'll boom. But people need motivation -- right now consumers aren't complaining about the security or performance of 3DES, so it's sticking around...
Well, different encryption technologies are better suited to different applications. Some are designed for streaming media vs files on your HD for instance, or for file compression. However, I can see the point that you are making is quite different in nature from that. In my point of view, people should pic encryptions that fit the following criteria.
1) Usful. You want an encryption that is actually worth using. Not worth encrypting something if it can be cracked without any effort.
2) Suited to the application, as I stated above.
3) Available Internationally (nobody wants to be stuck with a product that gets you arrested on export).
4) Open spec (you want it to work with other products.
** This list is in order of importance.
On top of that, your implementation should take the encryption seriously. Putting in a security measure, and then allowing someone to circumvent that is about as dumb as it gets. One example of this is window's passwords. It's case sensitive in Windows NT, but not in 95, on the same network. This means that, if your computer at least claims to be running Windows 95, you can cut the number of keys you need to check in order to crack into the network exponentially.
Just my $.02
Eh...
On a product I worked on until recently, encryption selection was done using the following formula:
(sensitivity of data)+(ease of implementation) = (arbitrary decision about how we felt about securing stuff)
An example, we would use a form of blowfish encryption for a configuration file that's super easy to decrypt. Because of the nature of the product, the content would be sniffable when being sent upstream anyhow, so we made the encryption just strong enough to resist a notepad surfer.
On another product, however, we were sending up private data. Now, it was usual registration data during install, but we had real privacy concerns, so we looked at our options and chose SSL because it was easy on our part to implement, but unlikely to be easilly sniffed/decrypted.
Conclusion of ramble: Whatever's easiest to implement with some allowance for the dsecurity of the data.
Security through obfuscation is coming to a close, so this method won't work much longer.
I find a few things are important in choosing an algorithm. From a math point of view, the optimal solution is NOT to go with the latest-and-greatest algorithm. Serpent, Twofish, and other new algorithms might be all fancy and wonderful, but they simply do not have the history behind them. They don't have years of continual battering that others do. 3DES, for example, has been around for ages. It has been beaten to death by cryptanalysts the world over, and it's still holding up very well. THIS is what makes someone confident in their selection of crypto algorithm. Sure, 3DES may not have a bazillion bits, but there are most likely no bone-headed mistakes in it. Serpent and Twofish probably don't have any either, but there just isn't the history there to say for sure. Encryption algorithms are like wine... Over time, some sour, and some develop into mature, robust, beautiful works of art. In this light, Blowfish becomes attractive. Its advantage over Twofish et al. is age. Its advantage over 3DES is its freedom. This is part of the reason why Blowfish is ubiquitous in the real world.
In any field, find the strangest thing and then explore it. -John Archibald Wheeler
The entire world eats, sleeps, breathes, and shits in plaintext, yellow-stickies, credit card numbers on disposed reciepts, telnet, rsh, chatty cordless phones, unencrypted mail, chatty websites, open scripts, broken permissions, pages left on the xerox, unlocked files, and phone numbers given to nasty skanks at a dirty bar that has a scan of your driver's license.
The only real way to keep your information private is to be a boring ugly uninteresting fucking nobody with no life and piece-of-shit computers on crappy dialup lines with no money, bad credit, and massive personality flaws. I got those bases covered!
And if you're reading this, you probably do too.
DontBlow.com is an absolute good.
Now, it's always possible to use an external source of randomness, which would allow both parties to create the one-time pad but would make it much more difficult for a third-party to, as the randomness would be time-sensitive. An example of that would be to use radio telescopes, pointed to a variable star, and using the readings as the random numbers. Sure, Dr Cracker of the Institute of Higher Snooping could break the message saying which star you were going to use, but unless he did so BEFORE the readings were to be taken, the information would be useless.
Another form of "uncrackable" cypher would be one which used variable-length keys with a large upper limit to the key length, where there were few or no synonyms, and no short-cuts can be taken. Unlike the previous case, where the cypher's key exists only for an instant and is secured by time rather than artificial means, this system relies on the potential keyspace being very large. By using variable-length keys, not only do you increase the number of keys the user must look through, you also make it much harder to determine if a given "solution" is correct.
(Variable-length keys are MUCH more difficult to program, precicely because of the synonym problem. The more keys that exist that produce the same output, the smaller the key-space. This means that you have to use (n+1)-state logic, rather than n-state, to include the case of null entries. Demonstrating a lack of synonyms for, say, 3-state encryption (if you're using binary) is going to be much more complex than if your key and data existed in the same base.
It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
Blowfish is very very simple to code and understand. The core loop is only a few lines long and is used to prepare the key and encrypt. The hardest part is getting the digits of Pi correct.
Twofish OTOH, is heavily beefed up to support the AES requirements such as 128-bit block sizes and is significantly more complex than Blowfish to understand, implement and optimize. Thus, people still prefer good old Blowfish.
As for other AES algorithms, some of them may still be under license restrictions (at least until they win the contest).
I'm not trying to start anything, but as far as _standards_ go, it's gonna be important to choose something that is available on multiple platforms.
Much as I dislike it, many of my friends use Windows, so if I am gonna encrypt something to send to them, I've got to use something that they can decrypt, right?
Many of my other friends (whom I tend to hold in higher esteem), use one form of Un*x. The same applies to them.
Then there are thoses people who use Macs (I tend to like them right off.)
Anyway, my point is that it's all about communication. If the person I'm sending something to can't decrypt what I'm sending, why send it encrypted?
-jjh o|
-E
Send mail here if you want to reach me.
Twofish isn't all that more difficult to understand than Blowfish, because it's basically just Blowfish with a few improvements and a change in block size as per AES standards.
The key to the popularity of Blowfish over Twofish is merely that Blowfish has been around for many more years. That would normally mean that the cipher is more "proven" than Twofish and others, except that the AES candidates which are still in the running have defied more cryptanalytic attacks than most other ciphers because of the barrage of attacks engendered by the AES process. This leaves the fact that Blowfish has been around longer and therefore gotten into more stuff as its only advantage.
Blowfish and Twofish are both very, very fast on 32-bit microprocessors, which is why they're generally the best contenders for inclusion in crypto programs. Triple-DES, on the other hand, is ungodly slow anywhere but in specialized hardware--because it was meant only as a stop-gap measure for when the 56-bit key length of DES became too short. As for AES candidates with potential, MARS is slower than Twofish but has an extraordinary security margin. It's the only cipher which uses all forms of cryptological tranformations, and therefore should be resistant to most forms of attack if not all. MARS is the one AES contender I'd trust as much as Twofish.
"The more corrupt the state, the more numerous the laws."--Tacitus, *The Annals*
According to Bob Baldwin, one reason we see a lot of Blowfish and not much of Twofish and other AES candidates is that Blowfish (like DES and 3DES) works on 8-byte blocks, where the AES candidates work on 16-byte blocks.
Crypto infrastructure is designed to allow different ciphers to be plugged in, but changing block size is more work. If you want to just drop in a cipher without changing anything else, you generally have to pick one that operates on the same size blocks.
I can't believe the parent comment was actually moderated up. Christ, that's sad...
Allow me to insert a little bit of clue into the mix:
Both Blowfish and Twofish require sub-keys (generated from the larger key) for each of the rounds. They're all related, but it's difficult to generate the original key from the sub-keys.
For both Blowfish and Twofish, it is possible to spend a good deal of time generating each of these sub-keys, before the encryption process begins. Store them in memory before you start encrypting, and simply look them up while encrypting.
Alternatively, if the amount of memory available is limited, the sub-keys can be generated on-the-fly. This certainly makes for a slower algorithm, but it decreases the memory requirements. Either way, it's still faster than DES...
And, yes, both ways will slow down an attacker, however slightly. But when you're looking at a 256-bit key, you have to remember that it's likely that the universe will collapse in upon itself before a brute-force key search finds the key.
And, if you want to implement something along these lines anyway, a better method for doing this is Rivest's "Package Transform" (paper at http://theory.lcs.mit.edu/~rivest/fusion.ps ). With the Package Transform, you can achieve much of the same effect, but longer messages make for greater difficulty. So, if the Blowfish/Twofish margin isn't enough, you can simply pad out your message.
Software implementations of 3DES can't keep up with 100mbit Ethernets, for example. So if I want to encrypt high speed networks, either I use a (very expensive) hardware implementation of 3DES, or I use another algorithm (like Blowfish or Twofish).
Hammer. screw. Screwdriver. Nail. Pick the appropriate (tool,problem) pair from the list. There's no such thing as a magic bullet that solves all problems.
-E
Send mail here if you want to reach me.
Sorry if I seam completely stupid, but what is the point? Why encrypt an mp3 just for it to be decrypted in the player? If the player has the key, and the user has the player, then the user has the key! I really don't understand how these mp3 encryption things are supposed to stop copying. If you can listen to it, then you can copy it. It only makes it more difficult to use, and loses customers, while not actually stopping people who are determined to copy music.
-E
Send mail here if you want to reach me.
To, partially, answer your question about the number of hits for Twofish and Blowfish, here we go:
There are two types of encryption techniques. There is symmetric (Blowfish, DES, etc.) and asymmetric (Twofish, RSA, etc.). Symmetric algorithms use only one key to encrypt and decrypt information. Asymmetric algorithms, sometimes called public key algorithms use two keys. One public and one private. The public key is used to encrypt while the private key is used to decrypt. Asymmetric algorithms are also usually designed to work in some way as digital signatures or identifiers.
So, first you need to figure out whether you need symmetric or asymmetric encryption. This eliminates an entire catagory. The reason you probably found so many Blowfish hits compared to Twofish is a.: Blowfish is older, and b.: symmetric algorithms tend to be simpler (mathematically) and easier to program.
You can probably find a more thorough explaination of the two algorithms at Schneier's web-page: www.counterpane.com
Ethan Jewett
E-mail: Now what spa I mean e-mail site does Microsoft run again?
Picking encryption is like picking your nose -- it's an intuitive process, and you know you've got the right "one" when you put your finger on it.
I would suggest Rot13. It is fast, real fast. Easy to implement, widly avaiable on all platforms. Free Public Domain License, don't have to pay RSCA (whatever there name is) mega bucks for licensing. It is importable and exportable to the United States (and probably to any other states).
It does have a few security flaws, but unless your are the NCSA you will have a difficult time cracking it. I heard there is a "seti@home"-like project, to distrub a brute force against Rot13, but I haven't heard anything else about it. They have probably give up since todays computer *could* takes years to firgure it out...
"`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
The reason that you do not see many implementations of the AES cyphers is that they have not been around for very long. The industry has not had a whole lot of time to beat on them. 3DES, on the other hand, has had a number of people hammering on it for a decade or two and it known to be quite secure. FEAL has had people hammering on it for years and is known to be much weaker. (IDEA is secure, but has serious patent problems.)
The reason you see so many implementations of Blowfish is that it has been hammered on for a while. The few problems with it have been fixed. It is fast. Most of all, it is FREE. It does not have the nasty little patent problems that many of the other algorithms have. Twofish will have the same status after it withstands the blows of cryptographers for a few more years.
I also suspect that another reason for the lack of adoption of AES canidates is that people are waiting to see which one comes out on top. Never underesitmate the power of buzzword complience in the minds of management.
"Trademarks are the heraldry of the new feudalism."
This is not true. More mathematical cryptosystems can be proven to be as secure as some difficult math problem (factoring, discrete log, etc.). Why not use these provably secure cryptosystems (Rabin, Goldwasser/Micali, etc.)? Because most of them are significantly less efficient, and because many outside of the theoretical crypto community probably don't even know of their existence. (There seems to be a large lag between the powerful systems invented by theorists, and what is implemented by any software developers)
The more efficient ciphers actually used in software tend to be of the "scramble" variety involving specific S-boxes full of random looking numbers and lots of connecting XOR gates. It is hard to prove anything formally about these ciphers since they are not based on number theory or formal mathematics. In regard to these ciphers not based on pure math problems (*fish, Serpent, 3DES, et. al) public scrutiny is the best hardening factor.
I wouldn't necessarily say that Blowfish is more secure than Twofish or Serpent just because it is older though. The AES candidates have probably undergone a lot more scrutiny than the non-AES candidates since they would potentially replace DES as a standard. This makes the crypto community focus more intensely on them then some arbitrary cipher.
As far as the original question on choosing encryption: I think the biggest issue is quality of existing implementation in libraries. I am a software developer that works almost exclusively in a crypto/security setting, and the first thing I look for in an algorithm is for it to be part of a tested, well-documented crypto library with a reasonable license (like openSSL perhaps). This is for two aspects of the same reason: crypto algorithms are not what people break when they break security systems.
Without a good library, I am either using a broken library or rolling my own. Rolling my own is riskier than using one that has been extensively tested by others.
Whether I use 3DES, IDEA, RSA, etc. is probably less important than the other parts of my code when I am writing security-related tools. Better to focus more time/energy making sure that all of my bounds checks are in place, no dangerous races exist, etc. These are what attackers use to break into systems.
One final note on the importance of "well-documented" libraries. The reason I emphasize this is because inherently libraries, more than any other software, are code to be reused. Good documentation facilitates reuse, and it makes things safer. I had an unfortunate experience with a poorly documented C crypto library (an old CryptoLib) that called free on the pointers passed to it as arguments without any indication whatsoever of this in the doc. The result was a program that would crash suddenly/mysteriously because of later accesses to that freed memory. This kind of thing could have been prevented if the doc had included the salient fact that my arguments were being freed (since this is hardly an expected behavior).
I agree 100% that Triple DES is a good algorithm to go for unless you have some reason not to. The main reason not to, of course, is performance; it's also a big, complex algorithm, so you don't want to try and implement it yourself. But if you don't need blistering performance out of your crypto, and you don't plan to implement the crypto yourself (the wise choice) then go for 3DES.
Freedom is *not* an issue with 3DES: you have all the same freedoms with it as you do with Blowfish. Blowfish's advantage over 3DES is substantially better performance in software, and greater simplicity. It's probably a good second choice for this sort of thing; it's pretty much the oldest standing unencumbered strong block cipher designed for speed in software, and thus among the most trustworthy.
Once the AES winner has been around awhile, this questions will be moot; everyone will use the AES for most applications that don't require some special other choice. The concensus at the last AES conference seemed to be that none of the AES candidates would be properly broken short of an extraordinary revolution in cryptanalysis that might leave none of today's ciphers standing; caveats apply to Rijndael (which some wanted extended to 18 rounds) and to RC6 (which just doesn't leave a lot of people with warm fuzzies on the security front).
Of course, the question arises whether it's a block cipher you really need at all. If you're doing bulk encryption, you need a stream cipher, and a block cipher in a chaining mode is just one way to build a stream cipher. Try asking a much more specific question on sci.crypt and see what advice you get. Normally the answer is that there's already a standard for what you're trying to do, and you're best off using what it mandates.
Ask me a more specific question and I'll try and give a more specific answer...
--
Xenu loves you!
Someone in the audience with me actually pointed out that twofish would be faster, and the authors of the paper replied that that was precisely why they didn't use it.
It's an interesting paper, nonetheless.
-Jeff Evarts, who has forgotten his Slashdot password
One thing people can do is use a cryptosystem instead of a single algorithm. This makes implememtation much easier, since people don't need to become familiar with Applied Cryptography and the literature on crypto. This is why people like SSL--it is free outside of the US, and will become free in the US on September 20th, and is a complete system belived to be secure.
One of the nice things about crypto research is that most of the research papers out there are freely available on the internet.
- Sam
The secret to enjoying Slashdot is to realize that it should not be taken too seriously.
Bruce Schneier has written the excellent book "Applied Cryprography". Many a programmer has their knowledge about cryptography from that book.
Since he is also the person behind Blowfish, and that algorithm is described nicely in his book, it becomes a natural choice for many people who has read the book. It is also know to be unencumbered with patent problems.
I would say the main reason for choosing a algorithm is that it is secure (have no known attacks against it) and is well know to the programmer. Because of "Applied Cryptography" Blowfish then becomes a natural choice. For other it would be 3DES.