MMH-Badger MAC

From testwiki
Revision as of 13:42, 17 October 2024 by imported>Frost (page moved: Changed link from UMAC to UMAC (cryptography) (×3) using Move+)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Badger is a message authentication code (MAC) based on the idea of universal hashing and was developedTemplate:When by Boesgaard, Scavenius, Pedersen, Christensen, and Zenner.[1] It is constructed by strengthening the ∆-universal hash family MMH using an ϵ-almost strongly universal (ASU) hash function family after the application of ENH (see below), where the value of ϵ is 1/(2325).[2] Since Badger is a MAC function based on the universal hash function approach, the conditions needed for the security of Badger are the same as those for other universal hash functions such as UMAC.

Introduction

The Badger MAC processes a message of length up to 2641 bits and returns an authentication tag of length u32 bits, where 1u5. According to the security needs, user can choose the value of u, that is the number of parallel hash trees in Badger. One can choose larger values of u, but those values do not influence further the security of MAC. The algorithm uses a 128-bit key and the limited message length to be processed under this key is 264.[3]

The key setup has to be run only once per key in order to run the Badger algorithm under a given key, since the resulting internal state of the MAC can be saved to be used with any other message that will be processed later.

ENH

Hash families can be combined in order to obtain new hash families. For the ϵ-AU, ϵ-A∆U, and ϵ-ASU families, the latter are contained in the former. For instance, an A∆U family is also an AU family, an ASU is also an A∆U family, and so forth. On the other hand, a stronger family can be reduced to a weaker one, as long as a performance gain can be reached. A method to reduce ∆-universal hash function to universal hash functions will be described in the following.

Theorem 2[1]

Let H be an ϵ-AΔU hash family from a set A to a set B. Consider a message (m,mb)A×B. Then the family H consisting of the functions h(m,mb)=H(m)+mb is ϵ-AU.

If mm, then the probability that h(m,mb)=h(m,m'b) is at most ϵ, since H is an ϵ-A∆U family. If m=m but mbmb, then the probability is trivially 0. The proof for Theorem 2 was described in [1]

The ENH-family is constructed based on the universal hash family NH (which is also used in UMAC):

NHK(M)=i=12(k(2i1)+wm(2i1))×(k2i+wm2i)mod22w

Where '+w' means 'addition modulo 2w', and mi,ki{0,,2w1}. It is a 2w-A∆U hash family.

Lemma 1[1]

The following version of NH is 2w-A∆U:

NHK(M)=(k1+wm1)×(k2+wm2)mod22w

Choosing w=32 and applying Theorem 1, one can obtain the 232-AU function family ENH, which will be the basic building block of the badger MAC:

ENHk1,k2(m1,m2,m3,m4)=(m1+32k1)(m2+32k2)+64m3+64232m4

where all arguments are 32-bits long and the output has 64-bits.

Construction

Badger is constructed using the strongly universality hash family and can be described as

=H*×F,[1]

where an ϵH*-AU universal function family H* is used to hash messages of any size onto a fixed size and an ϵF-ASU function family F is used to guarantee the strong universality of the overall construction. NH and ENH are used to construct H*. The maximum input size of the function family H* is 2641 and the output size is 128 bits, split into 64 bits each for the message and the hash. The collision probability for the H*-function ranges from 232 to 226.14. To construct the strongly universal function family F, the ∆-universal hash family MMH* is transformed into a strongly universal hash family by adding another key.

Two steps on Badger

There are two steps that have to be executed for every message: processing phase and finalize phase.[3]

Processing phase

In this phase, the data is hashed to a 64-bit string. A core function Template:Mvar : {0,1}64×{0,1}128{0,1}64 is used in this processing phase, that hashes a 128-bit string m2m1 to a 64-bit string h(k,m2,m1) as follows:

h(k,m2,m1)=(L(m1)+32L(k))(U(m1)+32U(k))+64m2

for any n, +n means addition modulo 2n. Given a Template:Tmath-bit string x, Template:Tmath means least significant n bits, and Template:Tmath means most significant n bits.

A message can be processed by using this function. Denote Template:Code by kji.

Pseudo-code of the processing phase is as follow.

L = |M|
if L = 0
    M1==Mu=0
    Go to finalization
r = L mod 64
if r ≠ 0:
    M=064rM
for i = 1 to u:
    Mi=M
    v=max{1,log2L6}
for j = 1 to v′:
    divide Template:Tmath into 64-bit blocks, Template:Tmath
if t is even:
    Template:Tmath
else
    Template:Tmath

Finalize phase

In this phase, the 64-string resulting from the processing phase is transformed into the desired MAC tag. This finalization phase uses the Rabbit stream cipher and uses both key setup and IV setup by taking the finalization key Template:Code as kji.

Pseudo-code of the finalization phase

RabbitKeySetup(K)
RabbitIVSetup(N)
for i = 1 to u:
    Qi=07LMi
    divide Template:Tmath into 27-bit blocks, Qi=q5iq1i
    Si=(j=15(qjiKji))+K6imodp
S=SuS1
S = S ⨁ RabbitNextbit(u∙32)
return S

Notation

From the pseudocode above, k denotes the key in the Rabbit Key Setup(K) which initializes Rabbit with the 128-bit key k. M denotes the message to be hashed and |M| denotes the length of the message in bits. Template:Tmath denotes a message M that is divided into i blocks. For the given Template:Tmath-bit string x then Template:Math and Template:Math respectively denoted its least significant n bits and most significant n bits.

Performance

Boesgard, Christensen and Zenner report the performance of Badger measured on a 1.0 GHz Pentium III and on a 1.7 GHz Pentium 4 processor.[1] The speed-optimized versions were programmed in assembly language inlined in C and compiled using the Intel C++ 7.1 compiler.

The following table presents Badger's properties for various restricted message lengths. "Memory req." denotes the amount of memory required to store the internal state including key material and the inner state of the Rabbit stream cipher . "Setup" denotes the key setup, and "Fin." denotes finalization with IV-setup.

Max. Message Size Forgery Bound Memory Reg. Setup Pentium III Fin. Pentium III Setup Pentium III Fin. Pentium III
211 bytes (e.g.IPsec) 257.7 400 bytes 1133 cycles 409 cycles 1774 cycles 776 cycles
215 bytes (e.g.TLS) 256.6 528 bytes 1370 cycles 421 cycles 2100 cycles 778 cycles
232 bytes 254.2 1072 bytes 2376 cycles 421 cycles 3488 cycles 778 cycles
2611 bytes 252.2 2000 bytes 4093 cycles 433 cycles 5854 cycles 800 cycles

MMH (Multilinear Modular Hashing)

The name MMH stands for Multilinear-Modular-Hashing. Applications in Multimedia are for example to verify the integrity of an on-line multimedia title. The performance of MMH is based on the improved support of integer scalar products in modern microprocessors.

MMH uses single precision scalar products as its most basic operation. It consists of a (modified) inner product between the message and a key modulo a prime p. The construction of MMH works in the finite field Fp for some prime integer p.

MMH*

MMH* involves a construction of a family of hash functions consisting of multilinear functions on Fpk for some positive integer Template:Mvar. The family MMH* of functions from Fpk to Fp is defined as follows.

MMH*={gx:FpkFp|xFpk}

where x, m are vectors, and the functions gx are defined as follows.

gx(m)=mxmodp=i=1nmiximodp

In the case of MAC, Template:Mvar is a message and Template:Mvar is a key where m=(m1,,mk) and x=(x1,,xk),xi,miFp.

MMH* should satisfy the security requirements of a MAC, enabling say Ana and Bob to communicate in an authenticated way. They have a secret key Template:Mvar. Say Charles listens to the conversation between Ana and Bob and wants to change the message into his own message to Bob which should pass as a message from Ana. So, his message Template:Mvar and Ana's message Template:Mvar will differ in at least one bit (e.g. m1m'1).

Assume that Charles knows that the function is of the form gx(m) and he knows Ana's message Template:Mvar but he does not know the key x then the probability that Charles can change the message or send his own message can be explained by the following theorem.

Theorem 1[4]:The family MMH* is ∆-universal.

Proof:

Take aFp, and let m,m be two different messages. Assume without loss of generality that m1m'1. Then for any choice of x2,x3,,xs, there is

Prx1[gx(m)gx(m)amodp]=Prx1[(m1x1+m2x2++mkxk)(m'1x1+m'2x2++m'kxk)amodp]=Prx1[(m1m'1)x1+(m2m'2)x2++(mkm'k)xk]amodp]=Prx1[(m1m'1)x1+k=2s(mkm'k)xkamodp]=Prx1[(m1m'1)x1ak=2s(mkm'k)xkmodp]=1p

To explain the theorem above, take Fp for p prime represent the field as Fp={0,1,,p1}p. If one takes an element in Fp, let say 0Fp then the probability that x1=0 is

Prx1Fp(x1=0)=1p

So, what one actually needs to compute is

Pr(x1,,xk)Fpk(gx(m)gx(m)modp)

But,

Pr(x1,,xk)Fpk(gx(m)gx(m)modp)=(x2,,xk)Fpk1Pr(x2',xk')Fpk1(x2=x2',,xk=xk')Prx1Fp(gx(m)gx(m)modp)=(x2,,xk)Fpk11pk11p=pk11pk11p=1p

From the proof above, 1p is the collision probability of the attacker in 1 round, so on average Template:Mvar verification queries will suffice to get one message accepted. To reduce the collision probability, it is necessary to choose large p or to concatenate Template:Mvar such MACs using Template:Mvar independent keys so that the collision probability] becomes 1pn. In this case the number of keys are increased by a factor of Template:Mvar and the output is also increased by Template:Mvar.

MMH*32

Halevi and Krawczyk[4] construct a variant called MMH32*. The construction works with 32-bit integers and with the prime integer p=232+15. Actually the prime p can be chosen to be any prime which satisfies 232<p<232+216. This idea is adopted from the suggestion by Carter and Wegman to use the primes 216+1 or 2311.

MMH32* is defined as follows:
MMH32*={gx({0,1}32)k}Fp,

where {0,1}32 means {0,1,,2321} (i.e., binary representation)

The functions gx are defined as follows.

gx(m) =def mxmod(232+15)=i=1kmiximod(232+15)

where

x=(x1,,xk), m=(m,,mk)

By theorem 1, the collision probability is about ϵ=232, and the family of MMH32* can be defined as ϵ-almost ∆ Universal with ϵ=232.

The value of k

The value of k that describes the length of the message and key vectors has several effects:

  • Since the costly modular reduction over k is multiply and add operations increasing k should decrease the speed.
  • Since the key x consist of k 32-bit integers increasing k will results in a longer key.
  • The probability of breaking the system is 1/p and p2k so increasing k makes the system harder to break.

Performance

Below are the timing results for various implementations of MMH[4] in 1997, designed by Halevi and Krawczyk.

  • A 150 MHz PowerPC 604 RISC machine running AIX
150 MHz PowerPC 604 Message in Memory Message in Cache
64-bit 390 Mbit/second 417 Mbit/second
32-bit output 597 Mbit/second 820 Mbit/second
150 MHz PowerPC 604 Message in Memory Message in Cache
64-bit 296 Mbit/second 356 Mbit/second
32-bit output 556 Mbit/second 813 Mbit/second
  • A 200 MHz Pentium-Pro machine running Linux
150 MHz PowerPC 604 Message in Memory Message in Cache
64-bit 380 Mbit/second 500 Mbit/second
32-bit output 645 Mbit/second 1080 Mbit/second

See also

References

Template:Reflist