- Hasty Pudding cipher
Infobox block cipher

name = Hasty Pudding Cipher

caption =

designers =Richard Schroeppel

publish date = 1998–06

derived from =

derived to =

related to =

certification =

key size = Variable

block size = Variable

structure =

rounds =

cryptanalysis =The

**Hasty Pudding Cipher (HPC)**is a variable-block-sizeblock cipher designed byRichard Schroeppel , which was an unsuccessful candidate in the competition for selecting the U.S.Advanced Encryption Standard (AES). It has a number of unusual properties for a block cipher: its input block size and key length are variable, and it includes an additional input parameter called the "spice" that is meant to be used as a secondary, non-secret key. The Hasty Pudding cipher was the only AES candidate designed exclusively by U.S. cryptographers. [] [Eli Biham , " [*http://csrc.nist.gov/archive/aes/round1/comments/990416-ebiham2.pdf A Note on Comparing the AES Candidates*] ", April 1999, public comment on AES.]Susan Landau , " [*http://www.cs.ucdavis.edu/~rogaway/classes/227/fall01/landau-aes.pdf Communications Security for the Twenty-first Century: The Advanced Encryption Standard*] ", Notices of the AMS, vol. 47, number 4, 2000.The Hasty Pudding cipher is in the public domain.

**The cipher**The Hasty Pudding cipher consists of 5 different sub-ciphersRich Schroeppel, " [

*http://www.cs.arizona.edu/~rcs/hpc/hpc-spec Hasty Pudding Cipher Specification*] ," May 1999 revision, accessed 9-01-2008.] :The Hasty Pudding cipher algorithms all use 64-bit words internally. The cipher is designed to run on 64-bit machines, which can easily perform simple operations on 64-bit words.

**Key expansion**The Hasty Pudding cipher can take a key of any number of bits for any one of the five subciphers. The cipher itself uses a "key table" of 16,384 bits (256 64-bit words). In order to derive the key table from the key, the key expansion function uses the following algorithm:

# The first three words, "KX" [0] , "KX" [1] , "KX" [2] are set based on constants, the sub-cipher, and the length of the key. "KX" [1] is computed with a multiplication; the other operations involved are an addition and a bit shift.

# Each successive word, "KX" ["i"] is determined from the three previous words by an efficient recursive formula.

# The key bits are XORed into the bits of the key table, starting at "KX" [0] , until all the key bits are used. (Keys longer than 8,192 bits use a more complicated procedure.)

# Several passes over the key table are made. Each time, a "stirring function" is applied to each word of the key table, in sequence. The stirring function uses eight internal variables, and uses 14 logical bit operations, 5 bit shifts, and 14 additions / subtractions. Each use of the stirring function will modify one word in the key table, based on its previous value, the values of certain other words, and the internal variables of the stirring function. (3 total passes is the default.)**Encryption and decryption**Each of the subciphers uses a different algorithm, but there are certain similarities. Three inputs are used to determine the ciphertext: the plaintext (in several 64-bit words plus one "fragment"), the spice (eight 64-bit words, with default value 0), and the key table. The operations within the cipher consist of "stirring", in which internal variables are combined in various ways, with values from the key table and spice being included at regular intervals. HPC-Short uses two fixed permutations in addition, and HPC-Tiny consists of many special sub-cases.

Decryption involves undoing the steps of encryption one by one. Many operations are easily undone (e.g. "s"0 = "s"0 + "s"1 is undone by computing "s"0 = "s"0 − "s"1). Other operations are more complex to undo. Some of the ideas involved include:

* An operation like "x" = "x" $oplus$ ("x" >> 17 ) is undone by a two-step process: (1) "x" = "x" $oplus$ ("x" >> 17 ), followed by (2) "x" = "x" $oplus$ ("x" >> 34 ).

* The cipher uses value-dependent lookups into the key table. These can be undone, since the lookup depends only on the last 8 bits of a variable, and when it becomes necessary to look up the value from the key table in decryption, the last 8 bits of the value at a certain earlier point in the computation are predictable, even when those operations cannot all be undone without the key table value. For instance, if the lookup of "k" is based on the last 8 bits of "x", then when we want to undo a step like "x" = "x" $oplus$ "k" << 8, we can look up "k" by noting that the last 8 bits of "x" are unchanged by this operation.The Hasty Pudding cipher can also be used to encrypt values in a range that do not translate to strings with an integral number of bits; for instance, it can encrypt a number from 0 to N by producing another number from 0 to "N". It does this by using the smallest subcipher that can handle the input as a bit string, and applying it to the input as a bit string, repeatedly, until the output is in the proper range.

**Performance**The Hasty Pudding cipher was claimed by Schroeppel to be the fastest AES candidate on a 64-bit architectureRich Schroeppel, " [

*http://www.cs.arizona.edu/~rcs/hpc/hpc-oneyearlater The Hasty Pudding Cipher: One Year Later*] ", accesss 9-01-2008] ; Schroeppel claimed it to be twice as fast as its nearest competitor,DFC (cipher) , and three times as fast as the other candidates, and that its performance on a 32-bit machine was adequate. Comments from others did not support this view; for instance, Schneier et al.'s analysis ranked the Hasty Pudding cipher 4th best (376 cycles) on a 64-bit machine, although forRijndael andTwofish , the performance was only estimated.Bruce Schneier ,John Kelsey ,Doug Whiting ,David Wagner ,Chris Hall , andNiels Ferguson , " [*http://www.windowsecurity.com/uplarticle/2/aes-performance.pdf Performance Comparison of the AES Submissions*] ", The Second AES Candidate Conference, 1999.] On a 32-bitpentium , Hasty Pudding encryption was rated by Schneier et al. at 1600 clock cycles, 10th best out of the 15 candidates. Schneier et al, and Schroeppel, noted that the speed of the cipher would be significantly impacted on a 32-bit machine because of its heavy use of 64-bit operations, particularly bit shifts.Rich Schroeppel and Hilarie Orman, " [*http://www.cs.arizona.edu/~rcs/hpc/hpc-overview An Overview of the Hasty Pudding Cipher*] ] ," July 1998.]The Hasty Pudding cipher's key setup was rated as relatively slow; 120000 cycles on a Pentium..

The cipher was criticized for its performance on

smartcard s. Specifically, some comments pointed out the difficulty of keeping over 2KB of RAM for the key table. [*Emanoil Daneliuc, [*]*http://csrc.nist.gov/archive/aes/round1/comments/990222-edaneliuc.pdf Public comment on AES candidates*] , February 1999.**Further work**There have been relatively few results on attacking the Hasty Pudding cipher. Early in the AES process,

David Wagner noted that relatively large classes of Hasty Pudding keys were equivalent in that they led to the same key table.David Wagner, "Equivalent keys for HPC", rump session talk at the 2nd AES Conference,Rome , March 1999.] This was expanded upon by D'Halluin et al., who noted that for 128-bit keys, approximately 2^{120}keys are "weak keys" which each have 2^{30}equivalent keys each. [*Carl D'Halluin, Gert Bijnens,*] In response to this attack, Schroeppel modified the key expansion algorithm to include one additional step.Bart Preneel , andVincent Rijmen , " [*http://www.cosic.esat.kuleuven.be/publications/article-74.pdf Equivalent Keys of HPC*] ", Advances in Cryptology — Proceedings of ASIACRYPT 1999, 1999.Despite the relative lack of cryptanalysis, the Hasty Pudding cipher was criticized for its hard-to-understand design and its lack of grounding in research results. [

*Olivier Baudron,*] Schroeppel has offered a bottle ofHenri Gilbert , Louis Granboulan,Helena Handschuh ,Antoine Joux ,Phong Nguyen , Fabrice Noilhan,David Pointcheval , Thomas Pornin, Guillaume Poupard,Jacques Stern , andSerge Vaudenay , " [*http://csrc.nist.gov/archive/aes/round1/conf2/papers/baudron1.pdf Report on the AES Candidates*] ", Second AES Conference, March 1999.Dom Perignon champagne to the best paper presenting progress on the Hasty Pudding cipher. It did not make the second round of consideration for AES. [*James Nechvatal, Elaine Barker, Lawrence Bassham, William Burr, Morris Dworkin, James Foti, and Edward Roback, " [*]*http://csrc.nist.gov/archive/aes/round2/r2report.pdf Report on the Development of the Advanced Encryption Standard (AES)*] ",NIST official release, October 2, 2000.The Hasty Pudding cipher is regarded to be the first

tweakable block cipher . [*Moses Liskov,*]Ronald Rivest , andDavid Wagner , "Tweakable Block Ciphers", in Advances in Cryptology — Proceedings of CRYPTO '02, 2002.**References**

*Wikimedia Foundation.
2010.*