Unit CryptUnit

BM-2cWv61m4UEEk5SqnQ86P6uNzTaJJRXVJ7A
Nov 9 18:45 [raw]

Unit CryptUnit; Interface Type SSCState = Record DA,DB,DC,DD: Byte; { Four state indices } S0,S1:Array[0..255]Of Byte; { Encryption/decryption state arrays } End; Function Encrypted(Var State: SSCState; Const IB:Byte):Byte; { Encrypts one byte at time } Function Decrypted(Var State: SSCState; Const IB:Byte):Byte; { Decrypts one byte at time } Procedure BufEnc(Var State: SSCState; Var Data; Const Size:LongWord); { Encrypts data } Procedure BufDec(Var State: SSCState; Var Data; Const Size:LongWord); { Decrypts data } Procedure BufMut(Var State: SSCState; Const Data; Const Size:LongWord); { Mutates key with data WITHOUT encrypting it } Procedure DataInit(Var State: SSCState; Const Data; Const Size:LongWord; Const Rounds:LongWord; Const Mode:Boolean); Procedure PassInit(Var State: SSCState; Const Key : String; Const Rounds:LongWord; Const Mode:Boolean); Procedure DataKSA(Var State: SSCState; Const Key; Const KeySize:LongWord; Const Vec; Const VecSize:LongWord; Const Rounds:Longword); Procedure PassKSA(Var State: SSCState; Const Key:String; Const Vec; Const VecSize:LongWord; Const Rounds:LongWord); Procedure SetMAC(Var State: SSCState; Var MAC; Const MACSize:LongWord); { Calculates MAC of already processed data } Procedure SetKeys(Var State: SSCState); { Set keys in start position } Procedure KeyMut(Var State: SSCState); { key mutation } Procedure Burn(Var State: SSCState); { Cleans the whole internal state } Implementation Type ByteArray = Array[0..0] Of Byte; Function Suc(Const InByte:Byte):Byte; begin Suc := Byte(Inbyte+1); end; Function Pre(Const InByte:Byte):Byte; begin Pre := Byte(Inbyte-1); end; Procedure NextState(Var State: SSCState); { Uses current cipher state to produce next state } Procedure SWAB(Var A,B: Byte); { Swaps two bytes } Var C : Byte; Begin C := A; A := B; B := C; End; Begin With State Do Begin Inc(DD); DC := S0[S0[(S0[(S0[(S0[DD]+DC) And $FF]+DB) And $FF]+DA) And $FF]]; SWAB(S0[DA],S0[DD]); S1[S0[DA]]:=DA; S1[S0[DD]]:=DD; SWAB(S0[DB],S0[DC]); S1[S0[DB]]:=DB; S1[S0[DC]]:=DC; End; End; Function Encrypted(Var State: SSCState; Const IB:Byte):Byte; Begin With State Do Begin DA := S0[Suc(S0[Pre(S0[IB Xor S0[Pre(S0[Suc(S0[DC])])]])])]; DB := S0[Pre(S0[Suc(S0[DA Xor S0[Suc(S0[Pre(S0[DD])])]])])]; Encrypted := S0[Suc(S0[Pre(S0[Suc(S0[Pre(S0[DB])])])])]; End; NextState(State); End; Function Decrypted(Var State: SSCState; Const IB:Byte):Byte; Begin With State Do Begin DB := S1[Suc(S1[Pre(S1[Suc(S1[Pre(S1[IB])])])])]; DA := S1[Pre(S1[Suc(S1[DB])])] Xor S0[Suc(S0[Pre(S0[DD])])]; Decrypted := S1[Suc(S1[Pre(S1[DA])])] Xor S0[Pre(S0[Suc(S0[DC])])]; End; NextState(State); End; Procedure BufEnc(Var State: SSCState; Var Data; Const Size:LongWord); Var IC:LongWord; Buf:ByteArray Absolute Data; Begin For IC := 0 To Size-1 Do Buf[IC] := Encrypted(State,Buf[IC]); End; Procedure BufDec(Var State: SSCState; Var Data; Const Size:LongWord); Var IC:LongWord; Buf:ByteArray Absolute Data; Begin For IC := 0 To Size-1 Do Buf[IC] := Decrypted(State,Buf[IC]); End; Procedure BufMut(Var State: SSCState; Const Data; Const Size:LongWord); Var IC:LongWord; Buf:ByteArray Absolute Data; Begin For IC := 0 To Size-1 Do Encrypted(State, Buf[IC]); End; Procedure DataInit(Var State: SSCState; Const Data; Const Size:LongWord; Const Rounds:LongWord; Const Mode:Boolean); Var IC:LongWord; Begin If Mode Then SetKeys(State); For IC := 1 To Rounds Do Begin BufMut(State,Data,Size); KeyMut(State); End; End; Procedure PassInit(Var State: SSCState; Const Key : String; Const Rounds:LongWord; Const Mode:Boolean); Begin If Mode Then SetKeys(State); DataInit(State,Key[1],Length(Key),Rounds,Mode); End; Procedure DataKSA(Var State: SSCState; Const Key; Const KeySize:LongWord; Const Vec; Const VecSize:LongWord; Const Rounds:Longword); Var IC:LongWord; Begin SetKeys(State); BufMut(State,Key,KeySize); KeyMut(State); For IC := 1 To Rounds Do Begin BufMut(State,Vec,VecSize); KeyMut(State); BufMut(State,Key,KeySize); KeyMut(State); End; End; Procedure PassKSA(Var State: SSCState; Const Key:String; Const Vec; Const VecSize:LongWord; Const Rounds:LongWord); Begin DataKSA(State,Key[1], Length(Key), Vec, VecSize, Rounds); End; Procedure SetKeys(Var State: SSCState); Var IC:Byte; Begin With State Do Begin For IC := 0 To 255 Do S0[IC] := IC; For IC := 0 To 255 Do S1[IC] := IC; DC := 0; DD := 255; End; End; Procedure KeyMut(Var State: SSCState); Var IC : Byte; Begin With State Do Begin For IC := 0 To 255 Do Encrypted(State,Encrypted(State,Encrypted(State,Encrypted(State,S0[IC])))); End; End; Procedure SetMAC(Var State: SSCState; Var MAC; Const MACSize:LongWord); Var C:LongWord; Buf:ByteArray Absolute MAC; Begin For C := 0 To MACSize-1 Do Encrypted(State,C); KeyMut(State); For C := 0 To MACSize-1 Do Buf[C] := Encrypted(State,C); End; Procedure Burn(Var State: SSCState); Begin FillChar(State,SizeOf(State),0); End; End.

[chan] general
BM-2cW67GEKkHGonXKZLCzouLLxnLym3azS8r

Subject Last Count
Trotsky in 1939 was pretty prescient -- before the battle of France, early 1940 Sep 26 13:32 2
just woke up - come on guys, write sth. ... Sep 26 13:09 3
the bookkeeper can be king if the public can be kept ignorant of the methodology of the Sep 26 13:04 3
The silent banker weapon : A software gun Sep 26 13:04 3
What's up with all the spam? Sep 26 13:04 3
Bitcoin giveaway Sep 26 08:05 3
UK Column News - 24th September 2018 - fucking kikes again Sep 26 03:06 1
hey only 2 people here ? Sep 26 02:50 2
[DELETED] Sep 25 10:13 1
[DELETED] Sep 25 09:39 1
[DELETED] Sep 25 09:09 1
[DELETED] Sep 25 08:46 1
[DELETED] Sep 25 08:37 1
[DELETED] Sep 25 07:33 1
[DELETED] Sep 25 07:21 1
UK Column News - 24th September 2018 Sep 25 06:58 2
Spam getting worse? Sep 25 06:58 3
UK Column News - 19th September 2018 FUCK THE KIKES ! Sep 23 23:44 6
Jeremy Corbyn Was a Communist Spy Sep 23 21:53 3
Is there anybody out there? Sep 23 20:37 6
099AD909BCDAF2CD68CF55411EA1763A Sep 23 18:13 1
Behold a Pale Horse by Milton William Cooper Sep 23 18:02 1
[DELETED] Sep 23 16:37 5
RU.POLITICS white list. Sep 22 14:18 1
UK Column News - 21st September 2018 - kike friendly as ever Sep 22 09:11 1
UK Column News - 23rd September 2018 Sep 22 08:58 1
UK Column News - 22nd September 2018 Sep 22 08:58 1
UK Column News - 21st September 2018 Sep 22 08:55 2
UK Column News - 25th September 2018 Sep 22 08:51 1
?Police Sep 22 08:20 2
FF87E840BB762C18D502912ED171BC59 Sep 21 21:24 1
mozilla nimcompoops Sep 21 19:04 2
well known troll and spamer Sep 21 16:54 1
current black list Sep 21 16:43 2
white list Sep 21 16:24 1
[DELETED] Sep 21 05:46 9
dÊâtH Tô pÊÐÖpHΣÊ$ Sep 21 01:07 1
dÊâTh tô pëdôphΣë$ Sep 21 01:07 1
dÊâTH Tô pÊÐÖphΣʧ Sep 21 01:07 1
dÊâth tô pëdôpHΣë$ Sep 21 01:07 1
dÊâTH tô pÊÐÖphΣʧ Sep 21 01:07 1
dÊâTH tô pëdôpHΣÊ$ Sep 21 01:07 1
dÊâtH Tô pÊÐÖphí£ë§ Sep 21 01:07 1
dÊâth tô pÊÐÖpHΣë$ Sep 21 01:07 1
dÊâTh tô pëdôphí£ë§ Sep 21 01:07 1
dÊâtH Tô pÊÐÖphΣʧ Sep 21 01:07 1
dÊâtH Tô pÊÐÖphΣÊ$ Sep 21 01:07 1
dÊâtH Tô pëdôpHí£ë$ Sep 21 01:07 1
dÊâTh tô pÊÐÖpHÎ£ë§ Sep 21 01:07 1
dÊâTH Tô pëdôpHí£Ê§ Sep 21 01:07 1
dÊâtH Tô pëdôphí£ë§ Sep 21 01:07 1
dÊâTh tô pëdôpHÎ£ë§ Sep 21 01:07 1
dÊâTH Tô pëdôphí£Ê$ Sep 21 01:07 1
dÊâTh tô pÊÐÖphΣʧ Sep 21 01:07 1
dÊâTH tô pÊÐÖpHí£ë§ Sep 21 01:07 1
dÊâTH Tô pëdôphΣë$ Sep 21 01:07 1
dÊâTh tô pëdôphΣʧ Sep 21 01:07 1
dÊâTh Tô pëdôphΣʧ Sep 21 01:07 1
dÊâTh tô pÊÐÖphΣÊ$ Sep 21 01:07 1
dÊâTh tô pëdôphΣÊ$ Sep 21 01:07 1
dÊâth tô pëdôphí£Ê§ Sep 21 01:07 1
dÊâTh Tô pëdôpHΣʧ Sep 21 01:07 1
dÊâth Tô pëdôphí£Ê§ Sep 21 01:07 1
dÊâth Tô pëdôpHÎ£ë§ Sep 21 01:07 1
dÊâTh Tô pëdôpHΣÊ$ Sep 21 01:07 1
dÊâtH tô pëdôphΣë$ Sep 21 01:07 1
dÊâTH Tô pÊÐÖphí£ë$ Sep 21 01:07 1
dÊâTh Tô pëdÖphí£Ê§ Sep 21 01:07 1
dÊâth tô pÊÐÖpHΣÊ$ Sep 21 01:07 1
dÊâTh Tô pëdôphí£Ê$ Sep 21 01:07 1
dÊâtH tô pëdôpHΣë$ Sep 21 01:07 1
dÊâTH tô pÊÐÖpHí£ë$ Sep 21 01:07 1
dÊâTh tô pëdôphÎ£ë§ Sep 21 01:07 1
dÊâth Tô pÊÐÖpHÎ£ë§ Sep 21 01:07 1
dÊâTh Tô pëdôphÎ£ë§ Sep 21 01:07 1
dÊâth Tô pÊÐÖpHΣʧ Sep 21 01:07 1
dÊâTh Tô pÊÐÖpHí£ë§ Sep 21 01:07 1
dÊâth Tô pÊÐÖpHΣÊ$ Sep 21 01:07 1
dÊâTh Tô pëdôpHÎ£ë§ Sep 21 01:07 1
dÊâtH tô pÊÐÖphΣʧ Sep 21 01:07 1
dÊâth tô pÊÐÖpHΣʧ Sep 21 01:07 1
dÊâth Tô pëdôphΣÊ$ Sep 21 01:07 1
dÊâtH Tô pëdôpHΣÊ$ Sep 21 01:07 1
dÊâth tô pÊÐÖphÎ£ë§ Sep 21 01:07 1
dÊâTh tô pÊÐÖpHí£ë§ Sep 21 01:07 1
dÊâTh tô pëdÖpHí£Ê$ Sep 21 01:07 1
dÊâth tô pëdôpHÎ£ë§ Sep 21 01:07 1
dÊâTH tô pëdôpHΣʧ Sep 21 01:07 1
dÊâth tô pÊÐÖphΣʧ Sep 21 01:07 1
dÊâTH tô pëdôphí£Ê§ Sep 21 01:07 1
dÊâTh Tô pÊÐÖpHΣÊ$ Sep 21 01:07 1
dÊâtH tô pëdôphÎ£ë§ Sep 21 01:07 1
dÊâTH tô pëdôpHí£ë§ Sep 21 01:07 1
dÊâTh Tô pëdôpHí£ë$ Sep 21 01:07 1
dÊâTH Tô pëdôpHí£Ê$ Sep 21 01:07 1
dÊâth Tô pëdÖphí£Ê§ Sep 21 01:07 1
dÊâTH Tô pëdôpHΣÊ$ Sep 21 01:07 1
dÊâTH tô pÊÐÖphΣë$ Sep 21 01:07 1
dÊâTh tô pÊÐÖphí£ë§ Sep 21 01:07 1
dÊâth Tô pëdôphΣë$ Sep 21 01:07 1