Unit CryptUnit

BM-2cWv61m4UEEk5SqnQ86P6uNzTaJJRXVJ7A
Nov 9 18:45

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
Critical vulnerability in v0.6.2 Feb 17 14:58 6
porno Feb 17 14:23 1
hire a hacker/access database/spy Feb 17 14:00 7
MeinCoin Crypto Research - Screenshot Feb 17 13:19 3
The image of Allah Feb 17 11:14 1
Don't forget to flush Feb 17 11:14 8
hire a hacker/delete criminal records Feb 17 09:01 4
Catching a cheating spouse Feb 17 08:01 5
Download it. Feb 17 07:55 2
teen girl Feb 17 06:42 23
A GUY WILL PERSUADEA GIRL TO SUICIDE! Feb 17 02:02 7
sup Feb 16 17:04 3
View from above Feb 16 16:27 2
CHEATING SPOUSE Feb 16 14:19 2
$ cd PyBitmessage ; git log | grep Author | sort -u | blacklist Feb 16 08:08 2
My confession Feb 16 08:01 3
Smell this Feb 15 16:32 2
Authenticity Feb 15 16:01 2
Rere Fact Feb 15 15:59 2
Clearing of Criminal record Feb 15 15:58 2
Naked teen girl Feb 15 15:58 1
Eliza 1 Feb 15 10:27 2
Eliza 3 Feb 15 09:47 1
Eliza 2 Feb 15 09:36 1
Help a child Feb 15 08:59 2
Spouse hunter Feb 15 08:58 2
Love for hacking Feb 15 08:58 2
Mitigating exploited software with firejail Feb 15 05:25 1
(no subject) Feb 15 02:49 15
NOTICE: Address Revocation Feb 15 02:27 1
Hack into your cheating spouse whatsapp and bank Feb 14 10:46 3
Genghis Koyn Broadcast : BM-5oDU4A7qT6dTKoJJGRkp3bUiZcXMcG8 Feb 14 10:41 2
looool Feb 13 23:25 1
Trump for 2020 Feb 13 21:10 2
Looking for historical copy of bitmessage objects Feb 13 17:56 1
Latest commit borked Feb 13 17:00 4
Death to all christians! Feb 13 15:57 1
Now wash your hands Feb 13 10:13 3
Bitcoin is a failure Feb 13 09:16 1
beach girl Feb 12 23:56 8
vv Feb 12 21:43 2
Image Feb 12 19:06 1
This denial of service shit needs to be patched Feb 12 18:51 7
What my dog did Feb 12 16:18 1
Miley-Cyrus-nude-003 Feb 12 16:17 3
Miley-Cyrus-nude-004 Feb 12 15:50 2
Now wipe your ass Feb 12 13:11 1
Bullshit Feb 12 04:22 1
Peckerwood Feb 12 04:17 1
so happy Feb 11 19:16 1
That feels better Feb 10 14:18 2
HALKETT, FREDERICK GODAR Feb 10 11:31 2
having him desirous for the release Feb 10 11:29 2
oppenheimer research to spheres Feb 10 11:02 2
93A5BA2BEF0A6EC71435CF417A0695EC Feb 10 10:42 1
Marijuana Cookbook Feb 10 10:36 1
[chan] 411 BM-2cW53MzWqtod8TA6vybdUeqd2LhTuXCX3L Feb 10 10:26 2
qwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyui Feb 10 09:32 1
qwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyuiqwertyui Feb 10 09:31 2
3F414A2933B1D3E26F3F8E73D14008FA Feb 10 09:31 1
z Feb 10 09:25 1
Any hoaxes under a set-up such as this could almost certainly be exposed Feb 10 09:24 1
mommy Feb 10 08:39 1
Culture Feb 10 08:27 1
You don't need to be a pervert. Feb 10 08:03 2
You should watch your mouth Feb 9 19:42 1
Fwd: Re: Did everyone else's BM starting freezing up Feb 9 12:31 1
Not much Feb 9 12:00 2
test2 Feb 9 11:44 1
test1 Feb 9 11:44 1
The Canonical List of Telephone Answering Machine Messages Feb 8 17:07 5
Forgiven Feb 8 16:39 4
Nationalism Feb 8 16:37 7
Extra Large! Feb 8 16:13 3
KCaH Needed Feb 8 08:21 1
sqlite> update inbox set folder="quarantine" where subject like "Warning! denial%"; Feb 8 03:52 1
DadaDodo for Windows Feb 7 11:37 2
Just for you Feb 7 11:37 1
Dark web child porn site ran ‘much better’ with FBI in charge Feb 7 09:15 1
WTF #centercore #falconheavy?? Feb 6 22:13 1
Доступ к кошельку Сатоши Накомото. Feb 6 17:58 1
Dead and gone Pakistan Feb 6 17:13 1
Searching for somewhat retro software Feb 6 12:53 3
channel flooder special Feb 6 11:40 4
Chew on this! Feb 6 11:01 3
ewe eet crae awn Feb 6 10:48 1
In the 'Bog of Eternal Stench' Feb 5 19:01 6
My CB radio Feb 5 13:10 1
pedo punisher requires apologies from the perverts Feb 5 12:52 2
boat girl Feb 5 12:50 1
beach girls Feb 5 12:37 1
There's no shortcut to fixing credit, I charge no upfront fee but patience must be paid in full Feb 5 08:38 30
NO Feb 4 22:14 1
better out than in Feb 4 19:58 2
PizzaGate - made in Moscow Feb 4 16:38 3
Alex Jones's InfoWars - a copy-paste RussiaToday outlet Feb 4 15:34 1
Links between Trump associates and Russian officials Feb 4 15:17 1
60 right-wing terrorist plots have been uncovered in the U.S. Feb 4 12:50 1
I did this Feb 4 12:37 5
posting pictures of poop is evil. it is not appropriate human behavior. it is wrong and you don't have a right to subject people to such disgusting behavior. Feb 4 12:32 8