next up previous contents
Next: The RC5 algorithm Up: Tiger code Previous: Tiger code

The TEA algorithm

 
let
  var c0:=12  /* cipher text */
  var c1:=23

  var p0:=45  /* plain text */
  var p1:=56
in
    let 
      var delta := 0x9e3779b9
      var sum := delta << 5
      var y := c0
      var z := c1

    in ( for n:= 1 to 32 do (
            z:=z - (((y << 4) + k0()) ^
                    ( y       + sum ) ^
                    ((y >> 5) + k1()) );
            y:=y - (((z << 4) + k0()) ^
                    ( z       + sum ) ^
                    ((z >> 5) + k1()) );
            sum:= sum - delta
         );
         c0:=y;
         c1:=z;
         (c0=p0)&&(c1=p1)
    )
    end
end



C. Scott Ananian
10/11/1997