unit HlpSHA3;

{$I HashLib.inc}

interface

uses
{$IFDEF DELPHI2010}
  SysUtils, // to get rid of compiler hint "not inlined" on Delphi 2010.
{$ENDIF DELPHI2010}
  HlpBits,
{$IFDEF DELPHI}
  HlpHashBuffer,
  HlpBitConverter,
  HlpHash,
{$ENDIF DELPHI}
  HlpIHashInfo,
  HlpIHash,
  HlpHashCryptoNotBuildIn,
  HlpConverters,
  HlpHashSize,
  HlpHashLibTypes;

type
  TSHA3 = class abstract(TBlockHash, ICryptoNotBuildIn, ITransformBlock)

  strict protected
    Fm_state: THashLibUInt64Array;
    FHashSize, FBlockSize: Int32;

    (*
      {$REGION 'Consts'}

      const

      RC: array [0 .. 23] of UInt64 = ($0000000000000001, $0000000000008082,
      $800000000000808A, $8000000080008000, $000000000000808B,
      $0000000080000001, $8000000080008081, $8000000000008009,
      $000000000000008A, $0000000000000088, $0000000080008009,
      $000000008000000A, $000000008000808B, $800000000000008B,
      $8000000000008089, $8000000000008003, $8000000000008002,
      $8000000000000080, $000000000000800A, $800000008000000A,
      $8000000080008081, $8000000000008080, $0000000080000001,
      $8000000080008008);

      {$ENDREGION}
    *)
    constructor Create(a_hash_size: THashSize);

    procedure Finish(); override;
    function GetResult(): THashLibByteArray; override;
    procedure TransformBlock(a_data: PByte; a_data_length: Int32;
      a_index: Int32); override;

  public
    procedure Initialize; override;

  end;

type

  TSHA3_224 = class sealed(TSHA3)

  public

    constructor Create();
    function Clone(): IHash; override;
  end;

type

  TSHA3_256 = class sealed(TSHA3)

  public

    constructor Create();
    function Clone(): IHash; override;
  end;

type

  TSHA3_384 = class sealed(TSHA3)

  public

    constructor Create();
    function Clone(): IHash; override;
  end;

type

  TSHA3_512 = class sealed(TSHA3)

  public

    constructor Create();
    function Clone(): IHash; override;
  end;

implementation

{ TSHA3 }

constructor TSHA3.Create(a_hash_size: THashSize);
begin
  Inherited Create(Int32(a_hash_size), 200 - (Int32(a_hash_size) * 2));

  FHashSize := HashSize;
  FBlockSize := BlockSize;

  System.SetLength(Fm_state, 25);

end;

procedure TSHA3.Finish;
var
  buffer_pos: Int32;
  block: THashLibByteArray;
begin
  buffer_pos := Fm_buffer.Pos;
  block := Fm_buffer.GetBytesZeroPadded();

  block[buffer_pos] := $6;
  block[FBlockSize - 1] := block[FBlockSize - 1] xor $80;

  TransformBlock(PByte(block), System.Length(block), 0);

  Fm_state[1] := not Fm_state[1];
  Fm_state[2] := not Fm_state[2];
  Fm_state[8] := not Fm_state[8];
  Fm_state[12] := not Fm_state[12];
  Fm_state[17] := not Fm_state[17];

end;

function TSHA3.GetResult: THashLibByteArray;
begin

  System.SetLength(result, FHashSize);

  TConverters.le64_copy(PUInt64(Fm_state), 0, PByte(result), 0,
    System.Length(result));

end;

procedure TSHA3.Initialize;
begin

  System.FillChar(Fm_state[0], System.Length(Fm_state) * System.SizeOf(UInt64),
    UInt64(0));

  Fm_state[1] := System.High(UInt64);
  Fm_state[2] := System.High(UInt64);
  Fm_state[8] := System.High(UInt64);
  Fm_state[12] := System.High(UInt64);
  Fm_state[17] := System.High(UInt64);
  Fm_state[20] := System.High(UInt64);

  Inherited Initialize();

end;

procedure TSHA3.TransformBlock(a_data: PByte; a_data_length: Int32;
  a_index: Int32);
var
  Aba, Abe, Abi, Abo, Abu, Aga, Age, Agi, Ago, Agu, Aka, Ake, Aki, Ako, Aku,
    Ama, Ame, Ami, Amo, Amu, Asa, Ase, Asi, Aso, Asu, Bba, Bbe, Bbi, Bbo, Bbu,
    Bga, Bge, Bgi, Bgo, Bgu, Bka, Bke, Bki, Bko, Bku, Bma, Bme, Bmi, Bmo, Bmu,
    Bsa, Bse, Bsi, Bso, Bsu, Ca, Ce, Ci, Co, Cu, Da, De, Di, &Do, Du, Eba, Ebe,
    Ebi, Ebo, Ebu, Ega, Ege, Egi, Ego, Egu, Eka, Eke, Eki, Eko, Eku, Ema, Eme,
    Emi, Emo, Emu, Esa, Ese, Esi, Eso, Esu: UInt64;
  data: array [0 .. 17] of UInt64;
  j: Int32;
begin
  TConverters.le64_copy(a_data, a_index, @(data[0]), 0, a_data_length);

  j := 0;

  while j < (FBlockSize shr 3) do
  begin
    Fm_state[j] := Fm_state[j] xor data[j];
    System.Inc(j);
  end;

  Aba := Fm_state[0];
  Abe := Fm_state[1];
  Abi := Fm_state[2];
  Abo := Fm_state[3];
  Abu := Fm_state[4];
  Aga := Fm_state[5];
  Age := Fm_state[6];
  Agi := Fm_state[7];
  Ago := Fm_state[8];
  Agu := Fm_state[9];
  Aka := Fm_state[10];
  Ake := Fm_state[11];
  Aki := Fm_state[12];
  Ako := Fm_state[13];
  Aku := Fm_state[14];
  Ama := Fm_state[15];
  Ame := Fm_state[16];
  Ami := Fm_state[17];
  Amo := Fm_state[18];
  Amu := Fm_state[19];
  Asa := Fm_state[20];
  Ase := Fm_state[21];
  Asi := Fm_state[22];
  Aso := Fm_state[23];
  Asu := Fm_state[24];

  Ca := Aba xor Aga xor Aka xor Ama xor Asa;
  Ce := Abe xor Age xor Ake xor Ame xor Ase;
  Ci := Abi xor Agi xor Aki xor Ami xor Asi;
  Co := Abo xor Ago xor Ako xor Amo xor Aso;
  Cu := Abu xor Agu xor Aku xor Amu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[0];
  Eba := Eba xor $0000000000000001;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[1];
  Aba := Aba xor $0000000000008082;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[2];
  Eba := Eba xor $800000000000808A;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[3];
  Aba := Aba xor $8000000080008000;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[4];
  Eba := Eba xor $000000000000808B;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[5];
  Aba := Aba xor $0000000080000001;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[6];
  Eba := Eba xor $8000000080008081;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[7];
  Aba := Aba xor $8000000000008009;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[8];
  Eba := Eba xor $000000000000008A;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[9];
  Aba := Aba xor $0000000000000088;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[10];
  Eba := Eba xor $0000000080008009;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[11];
  Aba := Aba xor $000000008000000A;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[12];
  Eba := Eba xor $000000008000808B;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[13];
  Aba := Aba xor $800000000000008B;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[14];
  Eba := Eba xor $8000000000008089;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[15];
  Aba := Aba xor $8000000000008003;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[16];
  Eba := Eba xor $8000000000008002;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[17];
  Aba := Aba xor $8000000000000080;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[18];
  Eba := Eba xor $000000000000800A;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[19];
  Aba := Aba xor $800000008000000A;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[20];
  Eba := Eba xor $8000000080008081;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[21];
  Aba := Aba xor $8000000000008080;
  Ca := Aba;
  Abe := Bbe xor (not Bbi or Bbo);
  Ce := Abe;
  Abi := Bbi xor (Bbo and Bbu);
  Ci := Abi;
  Abo := Bbo xor (Bbu or Bba);
  Co := Abo;
  Abu := Bbu xor (Bba and Bbe);
  Cu := Abu;
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Ca := Ca xor Aga;
  Age := Bge xor (Bgi and Bgo);
  Ce := Ce xor Age;
  Agi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Agi;
  Ago := Bgo xor (Bgu or Bga);
  Co := Co xor Ago;
  Agu := Bgu xor (Bga and Bge);
  Cu := Cu xor Agu;
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ca := Ca xor Aka;
  Ake := Bke xor (Bki and Bko);
  Ce := Ce xor Ake;
  Aki := Bki xor (not Bko and Bku);
  Ci := Ci xor Aki;
  Ako := (not Bko) xor (Bku or Bka);
  Co := Co xor Ako;
  Aku := Bku xor (Bka and Bke);
  Cu := Cu xor Aku;
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ca := Ca xor Ama;
  Ame := Bme xor (Bmi or Bmo);
  Ce := Ce xor Ame;
  Ami := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Ami;
  Amo := not Bmo xor (Bmu and Bma);
  Co := Co xor Amo;
  Amu := Bmu xor (Bma or Bme);
  Cu := Cu xor Amu;
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Asa;
  Ase := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ase;
  Asi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Asi;
  Aso := Bso xor (Bsu or Bsa);
  Co := Co xor Aso;
  Asu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Asu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Aba := Aba xor Da;
  Bba := Aba;
  Age := Age xor De;
  Bbe := TBits.RotateLeft64(Age, 44);
  Aki := Aki xor Di;
  Bbi := TBits.RotateLeft64(Aki, 43);
  Amo := Amo xor &Do;
  Bbo := TBits.RotateLeft64(Amo, 21);
  Asu := Asu xor Du;
  Bbu := TBits.RotateLeft64(Asu, 14);
  Eba := Bba xor (Bbe or Bbi);
  // Eba := Eba xor RC[22];
  Eba := Eba xor $0000000080000001;
  Ca := Eba;
  Ebe := Bbe xor (not Bbi or Bbo);
  Ce := Ebe;
  Ebi := Bbi xor (Bbo and Bbu);
  Ci := Ebi;
  Ebo := Bbo xor (Bbu or Bba);
  Co := Ebo;
  Ebu := Bbu xor (Bba and Bbe);
  Cu := Ebu;
  Abo := Abo xor &Do;
  Bga := TBits.RotateLeft64(Abo, 28);
  Agu := Agu xor Du;
  Bge := TBits.RotateLeft64(Agu, 20);
  Aka := Aka xor Da;
  Bgi := TBits.RotateLeft64(Aka, 3);
  Ame := Ame xor De;
  Bgo := TBits.RotateLeft64(Ame, 45);
  Asi := Asi xor Di;
  Bgu := TBits.RotateLeft64(Asi, 61);
  Ega := Bga xor (Bge or Bgi);
  Ca := Ca xor Ega;
  Ege := Bge xor (Bgi and Bgo);
  Ce := Ce xor Ege;
  Egi := Bgi xor (Bgo or not Bgu);
  Ci := Ci xor Egi;
  Ego := Bgo xor (Bgu or Bga);
  Co := Co xor Ego;
  Egu := Bgu xor (Bga and Bge);
  Cu := Cu xor Egu;
  Abe := Abe xor De;
  Bka := TBits.RotateLeft64(Abe, 1);
  Agi := Agi xor Di;
  Bke := TBits.RotateLeft64(Agi, 6);
  Ako := Ako xor &Do;
  Bki := TBits.RotateLeft64(Ako, 25);
  Amu := Amu xor Du;
  Bko := TBits.RotateLeft64(Amu, 8);
  Asa := Asa xor Da;
  Bku := TBits.RotateLeft64(Asa, 18);
  Eka := Bka xor (Bke or Bki);
  Ca := Ca xor Eka;
  Eke := Bke xor (Bki and Bko);
  Ce := Ce xor Eke;
  Eki := Bki xor (not Bko and Bku);
  Ci := Ci xor Eki;
  Eko := (not Bko) xor (Bku or Bka);
  Co := Co xor Eko;
  Eku := Bku xor (Bka and Bke);
  Cu := Cu xor Eku;
  Abu := Abu xor Du;
  Bma := TBits.RotateLeft64(Abu, 27);
  Aga := Aga xor Da;
  Bme := TBits.RotateLeft64(Aga, 36);
  Ake := Ake xor De;
  Bmi := TBits.RotateLeft64(Ake, 10);
  Ami := Ami xor Di;
  Bmo := TBits.RotateLeft64(Ami, 15);
  Aso := Aso xor &Do;
  Bmu := TBits.RotateLeft64(Aso, 56);
  Ema := Bma xor (Bme and Bmi);
  Ca := Ca xor Ema;
  Eme := Bme xor (Bmi or Bmo);
  Ce := Ce xor Eme;
  Emi := Bmi xor (not Bmo or Bmu);
  Ci := Ci xor Emi;
  Emo := not Bmo xor (Bmu and Bma);
  Co := Co xor Emo;
  Emu := Bmu xor (Bma or Bme);
  Cu := Cu xor Emu;
  Abi := Abi xor Di;
  Bsa := TBits.RotateLeft64(Abi, 62);
  Ago := Ago xor &Do;
  Bse := TBits.RotateLeft64(Ago, 55);
  Aku := Aku xor Du;
  Bsi := TBits.RotateLeft64(Aku, 39);
  Ama := Ama xor Da;
  Bso := TBits.RotateLeft64(Ama, 41);
  Ase := Ase xor De;
  Bsu := TBits.RotateLeft64(Ase, 2);
  Esa := Bsa xor (not Bse and Bsi);
  Ca := Ca xor Esa;
  Ese := not Bse xor (Bsi or Bso);
  Ce := Ce xor Ese;
  Esi := Bsi xor (Bso and Bsu);
  Ci := Ci xor Esi;
  Eso := Bso xor (Bsu or Bsa);
  Co := Co xor Eso;
  Esu := Bsu xor (Bsa and Bse);
  Cu := Cu xor Esu;
  Da := Cu xor TBits.RotateLeft64(Ce, 1);
  De := Ca xor TBits.RotateLeft64(Ci, 1);
  Di := Ce xor TBits.RotateLeft64(Co, 1);
  &Do := Ci xor TBits.RotateLeft64(Cu, 1);
  Du := Co xor TBits.RotateLeft64(Ca, 1);
  Eba := Eba xor Da;
  Bba := Eba;
  Ege := Ege xor De;
  Bbe := TBits.RotateLeft64(Ege, 44);
  Eki := Eki xor Di;
  Bbi := TBits.RotateLeft64(Eki, 43);
  Emo := Emo xor &Do;
  Bbo := TBits.RotateLeft64(Emo, 21);
  Esu := Esu xor Du;
  Bbu := TBits.RotateLeft64(Esu, 14);
  Aba := Bba xor (Bbe or Bbi);
  // Aba := Aba xor RC[23];
  Aba := Aba xor $8000000080008008;
  Abe := Bbe xor (not Bbi or Bbo);
  Abi := Bbi xor (Bbo and Bbu);
  Abo := Bbo xor (Bbu or Bba);
  Abu := Bbu xor (Bba and Bbe);
  Ebo := Ebo xor &Do;
  Bga := TBits.RotateLeft64(Ebo, 28);
  Egu := Egu xor Du;
  Bge := TBits.RotateLeft64(Egu, 20);
  Eka := Eka xor Da;
  Bgi := TBits.RotateLeft64(Eka, 3);
  Eme := Eme xor De;
  Bgo := TBits.RotateLeft64(Eme, 45);
  Esi := Esi xor Di;
  Bgu := TBits.RotateLeft64(Esi, 61);
  Aga := Bga xor (Bge or Bgi);
  Age := Bge xor (Bgi and Bgo);
  Agi := Bgi xor (Bgo or not Bgu);
  Ago := Bgo xor (Bgu or Bga);
  Agu := Bgu xor (Bga and Bge);
  Ebe := Ebe xor De;
  Bka := TBits.RotateLeft64(Ebe, 1);
  Egi := Egi xor Di;
  Bke := TBits.RotateLeft64(Egi, 6);
  Eko := Eko xor &Do;
  Bki := TBits.RotateLeft64(Eko, 25);
  Emu := Emu xor Du;
  Bko := TBits.RotateLeft64(Emu, 8);
  Esa := Esa xor Da;
  Bku := TBits.RotateLeft64(Esa, 18);
  Aka := Bka xor (Bke or Bki);
  Ake := Bke xor (Bki and Bko);
  Aki := Bki xor (not Bko and Bku);
  Ako := not Bko xor (Bku or Bka);
  Aku := Bku xor (Bka and Bke);
  Ebu := Ebu xor Du;
  Bma := TBits.RotateLeft64(Ebu, 27);
  Ega := Ega xor Da;
  Bme := TBits.RotateLeft64(Ega, 36);
  Eke := Eke xor De;
  Bmi := TBits.RotateLeft64(Eke, 10);
  Emi := Emi xor Di;
  Bmo := TBits.RotateLeft64(Emi, 15);
  Eso := Eso xor &Do;
  Bmu := TBits.RotateLeft64(Eso, 56);
  Ama := Bma xor (Bme and Bmi);
  Ame := Bme xor (Bmi or Bmo);
  Ami := Bmi xor (not Bmo or Bmu);
  Amo := not Bmo xor (Bmu and Bma);
  Amu := Bmu xor (Bma or Bme);
  Ebi := Ebi xor Di;
  Bsa := TBits.RotateLeft64(Ebi, 62);
  Ego := Ego xor &Do;
  Bse := TBits.RotateLeft64(Ego, 55);
  Eku := Eku xor Du;
  Bsi := TBits.RotateLeft64(Eku, 39);
  Ema := Ema xor Da;
  Bso := TBits.RotateLeft64(Ema, 41);
  Ese := Ese xor De;
  Bsu := TBits.RotateLeft64(Ese, 2);
  Asa := Bsa xor (not Bse and Bsi);
  Ase := not Bse xor (Bsi or Bso);
  Asi := Bsi xor (Bso and Bsu);
  Aso := Bso xor (Bsu or Bsa);
  Asu := Bsu xor (Bsa and Bse);

  Fm_state[0] := Aba;
  Fm_state[1] := Abe;
  Fm_state[2] := Abi;
  Fm_state[3] := Abo;
  Fm_state[4] := Abu;
  Fm_state[5] := Aga;
  Fm_state[6] := Age;
  Fm_state[7] := Agi;
  Fm_state[8] := Ago;
  Fm_state[9] := Agu;
  Fm_state[10] := Aka;
  Fm_state[11] := Ake;
  Fm_state[12] := Aki;
  Fm_state[13] := Ako;
  Fm_state[14] := Aku;
  Fm_state[15] := Ama;
  Fm_state[16] := Ame;
  Fm_state[17] := Ami;
  Fm_state[18] := Amo;
  Fm_state[19] := Amu;
  Fm_state[20] := Asa;
  Fm_state[21] := Ase;
  Fm_state[22] := Asi;
  Fm_state[23] := Aso;
  Fm_state[24] := Asu;

  System.FillChar(data, System.SizeOf(data), UInt64(0));
end;

{ TSHA3_224 }

function TSHA3_224.Clone(): IHash;
var
  HashInstance: TSHA3_224;
begin
  HashInstance := TSHA3_224.Create();
  HashInstance.Fm_state := System.Copy(Fm_state);
  HashInstance.Fm_buffer := Fm_buffer.Clone();
  HashInstance.Fm_processed_bytes := Fm_processed_bytes;
  result := HashInstance as IHash;
  result.BufferSize := BufferSize;
end;

constructor TSHA3_224.Create;
begin
  Inherited Create(THashSize.hsHashSize224);
end;

{ TSHA3_256 }

function TSHA3_256.Clone(): IHash;
var
  HashInstance: TSHA3_256;
begin
  HashInstance := TSHA3_256.Create();
  HashInstance.Fm_state := System.Copy(Fm_state);
  HashInstance.Fm_buffer := Fm_buffer.Clone();
  HashInstance.Fm_processed_bytes := Fm_processed_bytes;
  result := HashInstance as IHash;
  result.BufferSize := BufferSize;
end;

constructor TSHA3_256.Create;
begin
  Inherited Create(THashSize.hsHashSize256);
end;

{ TSHA3_384 }

function TSHA3_384.Clone(): IHash;
var
  HashInstance: TSHA3_384;
begin
  HashInstance := TSHA3_384.Create();
  HashInstance.Fm_state := System.Copy(Fm_state);
  HashInstance.Fm_buffer := Fm_buffer.Clone();
  HashInstance.Fm_processed_bytes := Fm_processed_bytes;
  result := HashInstance as IHash;
  result.BufferSize := BufferSize;
end;

constructor TSHA3_384.Create;
begin
  Inherited Create(THashSize.hsHashSize384);
end;

{ TSHA3_512 }

function TSHA3_512.Clone(): IHash;
var
  HashInstance: TSHA3_512;
begin
  HashInstance := TSHA3_512.Create();
  HashInstance.Fm_state := System.Copy(Fm_state);
  HashInstance.Fm_buffer := Fm_buffer.Clone();
  HashInstance.Fm_processed_bytes := Fm_processed_bytes;
  result := HashInstance as IHash;
  result.BufferSize := BufferSize;
end;

constructor TSHA3_512.Create;
begin
  Inherited Create(THashSize.hsHashSize512);
end;

end.
