Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Blowfish PB

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Blowfish PB

    'Blowfish.inc
    'Blowfish Encryption/Decryption
    '------------------------------------
    '
    'Information concerning the Blowfish
    'algorithm can be found at:
    'http://www.counterpane.com/blowfish.html
    '
    'Converted from VB version made by Fredrik Qvarfort
    '
    '
    DECLARE FUNCTION BFF(BYVAL x AS LONG) AS LONG
    DECLARE SUB strArrConv(strin AS STRING, BYREF temparray() AS BYTE)
    DECLARE FUNCTION ArrStrConv(temparray() AS BYTE) AS STRING
    DECLARE SUB BFEncryptByte(ByteArray() AS BYTE, Key AS STRING)
    DECLARE SUB BFDecryptByte(ByteArray() AS BYTE, Key AS STRING)
    DECLARE SUB BFDecryptBlock(Xl AS LONG, Xr AS LONG)
    DECLARE SUB BFEncryptBlock(Xl AS LONG, Xr AS LONG)
    DECLARE FUNCTION BFEncryptString(Texts AS STRING, Key AS STRING) AS STRING
    DECLARE FUNCTION BFDecryptString(Texts AS STRING, Key AS STRING) AS STRING
    DECLARE SUB BFClass_Initialize()
    DECLARE SUB BFKey(New_Value AS STRING)
    DECLARE FUNCTION uw_ShiftLeftBy8(wordX AS LONG) AS LONG


    'Constant for number of rounds
    %ROUNDS = 16

    'Keydependant p-boxes and s-boxes
    GLOBAL m_pBox() AS LONG
    GLOBAL m_sBox() AS LONG
    'Store buffered key
    GLOBAL m_KeyValue AS STRING


    'Declare Sub copymemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)

    SUB BFDecryptBlock(Xl AS LONG, Xr AS LONG)

    DIM i AS LONG
    DIM j AS LONG
    DIM Temp AS LONG

    Temp = Xr
    Xr = Xl XOR m_pBox(%ROUNDS + 1)
    Xl = Temp XOR m_pBox(%ROUNDS)

    j = %ROUNDS - 2
    FOR i = 0 TO (%ROUNDS \ 2 - 1)

    Xl = Xl XOR BFF(Xr)
    Xr = Xr XOR m_pBox(j + 1)
    Xr = Xr XOR BFF(Xl)
    Xl = Xl XOR m_pBox(j)
    j = j - 2
    NEXT

    END SUB

    SUB BFEncryptBlock(Xl AS LONG, Xr AS LONG)

    DIM i AS LONG
    DIM j AS LONG
    DIM Temp AS LONG

    j = 0
    FOR i = 0 TO (%ROUNDS \ 2 - 1)
    Xl = Xl XOR m_pBox(j)
    Xr = Xr XOR BFF(Xl)
    Xr = Xr XOR m_pBox(j + 1)
    Xl = Xl XOR BFF(Xr)
    j = j + 2
    NEXT

    Temp = Xr
    Xr = Xl XOR m_pBox(%ROUNDS)
    Xl = Temp XOR m_pBox(%ROUNDS + 1)

    END SUB

    SUB BFEncryptByte(ByteArray() AS BYTE, Key AS STRING)

    DIM Offset AS LONG
    DIM OrigLen AS LONG
    DIM LeftWord AS LONG
    DIM RightWord AS LONG
    DIM CipherLen AS LONG
    DIM CipherLeft AS LONG
    DIM CipherRight AS LONG
    DIM CurrPercent AS LONG
    DIM NextPercent AS LONG
    DIM seed AS LONG

    'Set the new key if one was provided

    'Get the size of the original array
    OrigLen = UBOUND(ByteArray) + 1

    'First we add 12 bytes (4 bytes for the
    'length and 8 bytes for the seed values
    'for the CBC routine), and the ciphertext
    'must be a multiple of 8 bytes
    CipherLen = OrigLen + 12
    IF (CipherLen MOD 8 <> 0) THEN
    CipherLen = CipherLen + 8 - (CipherLen MOD 8)
    END IF

    REDIM PRESERVE ByteArray(CipherLen - 1)

    CALL copymemory( VARPTR(ByteArray(12)), VARPTR(ByteArray(0)), OrigLen)

    'Store the length descriptor in bytes [9-12]
    CALL copymemory(VARPTR(ByteArray(8)), VARPTR(OrigLen), 4)

    'Store a block of random data in bytes [1-8],
    'these work as seed values for the CBC routine
    'and is used to produce different ciphertext
    'even when encrypting the same data with the
    'same key)
    RANDOMIZE TIMER
    seed=CLNG(2147483647 * RND())
    CALL copymemory(VARPTR(ByteArray(0)), VARPTR(seed), 4)
    seed=CLNG(2147483647 * RND())
    CALL copymemory(VARPTR(ByteArray(4)), VARPTR(seed), 4)
    'Encrypt the data in 64-bit blocks
    FOR Offset = 0 TO (CipherLen - 1) STEP 8
    'Get the next block of plaintext
    CALL GetWord(LeftWord, ByteArray(), Offset)
    CALL GetWord(RightWord, ByteArray(), Offset + 4)

    'XOR the plaintext with the previous
    'ciphertext (CBC, Cipher-Block Chaining)
    LeftWord = LeftWord XOR CipherLeft
    RightWord = RightWord XOR CipherRight

    'Encrypt the block
    CALL BFEncryptBlock(LeftWord, RightWord)

    'Store the block
    CALL PutWord(LeftWord, ByteArray(), Offset)
    CALL PutWord(RightWord, ByteArray(), Offset + 4)

    'Store the cipherblock (for CBC)
    CipherLeft = LeftWord
    CipherRight = RightWord
    NEXT
    END SUB
    FUNCTION BFEncryptString(Texts AS STRING, Key AS STRING) AS STRING

    DIM ByteArray() AS BYTE
    BFkey key
    'Convert the string to a bytearray
    StrArrConv Texts,ByteArray()
    'Encrypt the array
    CALL BFEncryptByte(ByteArray(), Key)
    'Return the encrypted data as a string
    BFEncryptString = ArrStrConv(ByteArray())

    END FUNCTION

    FUNCTION BFDecryptString(Texts AS STRING, Key AS STRING) AS STRING

    DIM ByteArray() AS BYTE

    BFkey key
    'Convert the string to a bytearray
    StrArrConv Texts,bytearray()

    'Encrypt the array
    CALL BFDecryptByte(ByteArray(), Key)

    'Return the encrypted data as a string
    BFDecryptString = ArrStrConv(ByteArray())

    END FUNCTION

    SUB strArrConv(strin AS STRING, BYREF temparray() AS BYTE)
    DIM i AS DWORD

    REDIM PRESERVE temparray(LEN(strin)-1)
    FOR i=1 TO LEN(strin)
    temparray(i-1)=ASC(MID$(strin,i,1))
    NEXT
    END SUB

    FUNCTION ArrStrConv(temparray() AS BYTE) AS STRING
    DIM u AS DWORD
    DIM i AS DWORD
    DIM strout AS STRING
    u=UBOUND(temparray)
    strout=""
    FOR i=0 TO u
    strout=strout+CHR$(temparray(i))
    NEXT
    FUNCTION=strout
    END FUNCTION

    SUB BFDecryptByte(ByteArray() AS BYTE, Key AS STRING)

    DIM Offset AS LONG
    DIM OrigLen AS LONG
    DIM LeftWord AS LONG
    DIM RightWord AS LONG
    DIM CipherLen AS LONG
    DIM CipherLeft AS LONG
    DIM CipherRight AS LONG
    DIM CurrPercent AS LONG
    DIM NextPercent AS LONG

    'Set the new key if one was provided

    'Get the size of the ciphertext
    CipherLen = UBOUND(ByteArray) + 1

    'Decrypt the data in 64-bit blocks
    FOR Offset = 0 TO (CipherLen - 1) STEP 8
    'Get the next block of ciphertext
    CALL GetWord(LeftWord, ByteArray(), Offset)
    CALL GetWord(RightWord, ByteArray(), Offset + 4)

    'Decrypt the block
    CALL BFDecryptBlock(LeftWord, RightWord)

    'XOR with the previous cipherblock
    LeftWord = LeftWord XOR CipherLeft
    RightWord = RightWord XOR CipherRight

    'Store the current ciphertext to use
    'XOR with the next block plaintext
    CALL GetWord(CipherLeft, ByteArray(), Offset)
    CALL GetWord(CipherRight, ByteArray(), Offset + 4)

    'Store the block
    CALL PutWord(LeftWord, ByteArray(), Offset)
    CALL PutWord(RightWord, ByteArray(), Offset + 4)

    NEXT

    'Get the size of the original array
    CALL copymemory(VARPTR(OrigLen), VARPTR(ByteArray(8)), 4)

    'Make sure OrigLen is a reasonable value,
    'if we used the wrong key the next couple
    'of statements could be dangerous (GPF)
    IF (CipherLen - OrigLen > 19) OR (CipherLen - OrigLen < 12) THEN
    'Error
    END IF

    'Resize the bytearray to hold only the plaintext
    'and not the extra information added by the
    'encryption routine
    CALL copymemory(VARPTR(ByteArray(0)), VARPTR(ByteArray(12)), OrigLen)
    REDIM PRESERVE ByteArray(OrigLen - 1)

    'Make sure we return a 100% progress

    END SUB

    FUNCTION BFF(BYVAL x AS LONG) AS LONG

    DIM xb(3) AS BYTE

    CALL copymemory(VARPTR(xb(0)), VARPTR(x), 4)
    BFF = (((m_sBox(0, xb(3)) + m_sBox(1, xb(2))) XOR m_sBox(2, xb(1))) + m_sBox(3, xb(0)))

    END FUNCTION


    SUB BFClass_Initialize()

    DIM m_pBox(%ROUNDS + 1) AS LONG
    DIM m_sBox(3,255) AS LONG

    'We need to check if we are running in compiled
    '(EXE) mode or in the IDE, this will allow us to
    'use optimized code with unsigned integers in
    'compiled mode without any overflow errors when
    'running the code in the IDE
    ON ERROR RESUME NEXT

    'Initialize p-boxes
    m_pBox(0) = &H243F6A88
    m_pBox(1) = &H85A308D3
    m_pBox(2) = &H13198A2E
    m_pBox(3) = &H3707344
    m_pBox(4) = &HA4093822
    m_pBox(5) = &H299F31D0
    m_pBox(6) = &H82EFA98
    m_pBox(7) = &HEC4E6C89
    m_pBox(8) = &H452821E6
    m_pBox(9) = &H38D01377
    m_pBox(10) = &HBE5466CF
    m_pBox(11) = &H34E90C6C
    m_pBox(12) = &HC0AC29B7
    m_pBox(13) = &HC97C50DD
    m_pBox(14) = &H3F84D5B5
    m_pBox(15) = &HB5470917
    m_pBox(16) = &H9216D5D9
    m_pBox(17) = &H8979FB1B

    'Initialize s-boxes
    m_sBox(0, 0) = &HD1310BA6
    m_sBox(1, 0) = &H98DFB5AC
    m_sBox(2, 0) = &H2FFD72DB
    m_sBox(3, 0) = &HD01ADFB7
    m_sBox(0, 1) = &HB8E1AFED
    m_sBox(1, 1) = &H6A267E96
    m_sBox(2, 1) = &HBA7C9045
    m_sBox(3, 1) = &HF12C7F99
    m_sBox(0, 2) = &H24A19947
    m_sBox(1, 2) = &HB3916CF7
    m_sBox(2, 2) = &H801F2E2
    m_sBox(3, 2) = &H858EFC16
    m_sBox(0, 3) = &H636920D8
    m_sBox(1, 3) = &H71574E69
    m_sBox(2, 3) = &HA458FEA3
    m_sBox(3, 3) = &HF4933D7E
    m_sBox(0, 4) = &HD95748F
    m_sBox(1, 4) = &H728EB658
    m_sBox(2, 4) = &H718BCD58
    m_sBox(3, 4) = &H82154AEE
    m_sBox(0, 5) = &H7B54A41D
    m_sBox(1, 5) = &HC25A59B5
    m_sBox(2, 5) = &H9C30D539
    m_sBox(3, 5) = &H2AF26013
    m_sBox(0, 6) = &HC5D1B023
    m_sBox(1, 6) = &H286085F0
    m_sBox(2, 6) = &HCA417918
    m_sBox(3, 6) = &HB8DB38EF
    m_sBox(0, 7) = &H8E79DCB0
    m_sBox(1, 7) = &H603A180E
    m_sBox(2, 7) = &H6C9E0E8B
    m_sBox(3, 7) = &HB01E8A3E
    m_sBox(0, 8) = &HD71577C1
    m_sBox(1, 8) = &HBD314B27
    m_sBox(2, 8) = &H78AF2FDA
    m_sBox(3, 8) = &H55605C60
    m_sBox(0, 9) = &HE65525F3
    m_sBox(1, 9) = &HAA55AB94
    m_sBox(2, 9) = &H57489862
    m_sBox(3, 9) = &H63E81440
    m_sBox(0, 10) = &H55CA396A
    m_sBox(1, 10) = &H2AAB10B6
    m_sBox(2, 10) = &HB4CC5C34
    m_sBox(3, 10) = &H1141E8CE
    m_sBox(0, 11) = &HA15486AF
    m_sBox(1, 11) = &H7C72E993
    m_sBox(2, 11) = &HB3EE1411
    m_sBox(3, 11) = &H636FBC2A
    m_sBox(0, 12) = &H2BA9C55D
    m_sBox(1, 12) = &H741831F6
    m_sBox(2, 12) = &HCE5C3E16
    m_sBox(3, 12) = &H9B87931E
    m_sBox(0, 13) = &HAFD6BA33
    m_sBox(1, 13) = &H6C24CF5C
    m_sBox(2, 13) = &H7A325381
    m_sBox(3, 13) = &H28958677
    m_sBox(0, 14) = &H3B8F4898
    m_sBox(1, 14) = &H6B4BB9AF
    m_sBox(2, 14) = &HC4BFE81B
    m_sBox(3, 14) = &H66282193
    m_sBox(0, 15) = &H61D809CC
    m_sBox(1, 15) = &HFB21A991
    m_sBox(2, 15) = &H487CAC60
    m_sBox(3, 15) = &H5DEC8032
    m_sBox(0, 16) = &HEF845D5D
    m_sBox(1, 16) = &HE98575B1
    m_sBox(2, 16) = &HDC262302
    m_sBox(3, 16) = &HEB651B88
    m_sBox(0, 17) = &H23893E81
    m_sBox(1, 17) = &HD396ACC5
    m_sBox(2, 17) = &HF6D6FF3
    m_sBox(3, 17) = &H83F44239
    m_sBox(0, 18) = &H2E0B4482
    m_sBox(1, 18) = &HA4842004
    m_sBox(2, 18) = &H69C8F04A
    m_sBox(3, 18) = &H9E1F9B5E
    m_sBox(0, 19) = &H21C66842
    m_sBox(1, 19) = &HF6E96C9A
    m_sBox(2, 19) = &H670C9C61
    m_sBox(3, 19) = &HABD388F0
    m_sBox(0, 20) = &H6A51A0D2
    m_sBox(1, 20) = &HD8542F68
    m_sBox(2, 20) = &H960FA728
    m_sBox(3, 20) = &HAB5133A3
    m_sBox(0, 21) = &H6EEF0B6C
    m_sBox(1, 21) = &H137A3BE4
    m_sBox(2, 21) = &HBA3BF050
    m_sBox(3, 21) = &H7EFB2A98
    m_sBox(0, 22) = &HA1F1651D
    m_sBox(1, 22) = &H39AF0176
    m_sBox(2, 22) = &H66CA593E
    m_sBox(3, 22) = &H82430E88
    m_sBox(0, 23) = &H8CEE8619
    m_sBox(1, 23) = &H456F9FB4
    m_sBox(2, 23) = &H7D84A5C3
    m_sBox(3, 23) = &H3B8B5EBE
    m_sBox(0, 24) = &HE06F75D8
    m_sBox(1, 24) = &H85C12073
    m_sBox(2, 24) = &H401A449F
    m_sBox(3, 24) = &H56C16AA6
    m_sBox(0, 25) = &H4ED3AA62
    m_sBox(1, 25) = &H363F7706
    m_sBox(2, 25) = &H1BFEDF72
    m_sBox(3, 25) = &H429B023D
    m_sBox(0, 26) = &H37D0D724
    m_sBox(1, 26) = &HD00A1248
    m_sBox(2, 26) = &HDB0FEAD3
    m_sBox(3, 26) = &H49F1C09B
    m_sBox(0, 27) = &H75372C9
    m_sBox(1, 27) = &H80991B7B
    m_sBox(2, 27) = &H25D479D8
    m_sBox(3, 27) = &HF6E8DEF7
    m_sBox(0, 28) = &HE3FE501A
    m_sBox(1, 28) = &HB6794C3B
    m_sBox(2, 28) = &H976CE0BD
    m_sBox(3, 28) = &H4C006BA
    m_sBox(0, 29) = &HC1A94FB6
    m_sBox(1, 29) = &H409F60C4
    m_sBox(2, 29) = &H5E5C9EC2
    m_sBox(3, 29) = &H196A2463
    m_sBox(0, 30) = &H68FB6FAF
    m_sBox(1, 30) = &H3E6C53B5
    m_sBox(2, 30) = &H1339B2EB
    m_sBox(3, 30) = &H3B52EC6F
    m_sBox(0, 31) = &H6DFC511F
    m_sBox(1, 31) = &H9B30952C
    m_sBox(2, 31) = &HCC814544
    m_sBox(3, 31) = &HAF5EBD09
    m_sBox(0, 32) = &HBEE3D004
    m_sBox(1, 32) = &HDE334AFD
    m_sBox(2, 32) = &H660F2807
    m_sBox(3, 32) = &H192E4BB3
    m_sBox(0, 33) = &HC0CBA857
    m_sBox(1, 33) = &H45C8740F
    m_sBox(2, 33) = &HD20B5F39
    m_sBox(3, 33) = &HB9D3FBDB
    m_sBox(0, 34) = &H5579C0BD
    m_sBox(1, 34) = &H1A60320A
    m_sBox(2, 34) = &HD6A100C6
    m_sBox(3, 34) = &H402C7279
    m_sBox(0, 35) = &H679F25FE
    m_sBox(1, 35) = &HFB1FA3CC
    m_sBox(2, 35) = &H8EA5E9F8
    m_sBox(3, 35) = &HDB3222F8
    m_sBox(0, 36) = &H3C7516DF
    m_sBox(1, 36) = &HFD616B15
    m_sBox(2, 36) = &H2F501EC8
    m_sBox(3, 36) = &HAD0552AB
    m_sBox(0, 37) = &H323DB5FA
    m_sBox(1, 37) = &HFD238760
    m_sBox(2, 37) = &H53317B48
    m_sBox(3, 37) = &H3E00DF82
    m_sBox(0, 38) = &H9E5C57BB
    m_sBox(1, 38) = &HCA6F8CA0
    m_sBox(2, 38) = &H1A87562E
    m_sBox(3, 38) = &HDF1769DB
    m_sBox(0, 39) = &HD542A8F6
    m_sBox(1, 39) = &H287EFFC3
    m_sBox(2, 39) = &HAC6732C6
    m_sBox(3, 39) = &H8C4F5573
    m_sBox(0, 40) = &H695B27B0
    m_sBox(1, 40) = &HBBCA58C8
    m_sBox(2, 40) = &HE1FFA35D
    m_sBox(3, 40) = &HB8F011A0
    m_sBox(0, 41) = &H10FA3D98
    m_sBox(1, 41) = &HFD2183B8
    m_sBox(2, 41) = &H4AFCB56C
    m_sBox(3, 41) = &H2DD1D35B
    m_sBox(0, 42) = &H9A53E479
    m_sBox(1, 42) = &HB6F84565
    m_sBox(2, 42) = &HD28E49BC
    m_sBox(3, 42) = &H4BFB9790
    m_sBox(0, 43) = &HE1DDF2DA
    m_sBox(1, 43) = &HA4CB7E33
    m_sBox(2, 43) = &H62FB1341
    m_sBox(3, 43) = &HCEE4C6E8
    m_sBox(0, 44) = &HEF20CADA
    m_sBox(1, 44) = &H36774C01
    m_sBox(2, 44) = &HD07E9EFE
    m_sBox(3, 44) = &H2BF11FB4
    m_sBox(0, 45) = &H95DBDA4D
    m_sBox(1, 45) = &HAE909198
    m_sBox(2, 45) = &HEAAD8E71
    m_sBox(3, 45) = &H6B93D5A0
    m_sBox(0, 46) = &HD08ED1D0
    m_sBox(1, 46) = &HAFC725E0
    m_sBox(2, 46) = &H8E3C5B2F
    m_sBox(3, 46) = &H8E7594B7
    m_sBox(0, 47) = &H8FF6E2FB
    m_sBox(1, 47) = &HF2122B64
    m_sBox(2, 47) = &H8888B812
    m_sBox(3, 47) = &H900DF01C
    m_sBox(0, 48) = &H4FAD5EA0
    m_sBox(1, 48) = &H688FC31C
    m_sBox(2, 48) = &HD1CFF191
    m_sBox(3, 48) = &HB3A8C1AD
    m_sBox(0, 49) = &H2F2F2218
    m_sBox(1, 49) = &HBE0E1777
    m_sBox(2, 49) = &HEA752DFE
    m_sBox(3, 49) = &H8B021FA1
    m_sBox(0, 50) = &HE5A0CC0F
    m_sBox(1, 50) = &HB56F74E8
    m_sBox(2, 50) = &H18ACF3D6
    m_sBox(3, 50) = &HCE89E299
    m_sBox(0, 51) = &HB4A84FE0
    m_sBox(1, 51) = &HFD13E0B7
    m_sBox(2, 51) = &H7CC43B81
    m_sBox(3, 51) = &HD2ADA8D9
    m_sBox(0, 52) = &H165FA266
    m_sBox(1, 52) = &H80957705
    m_sBox(2, 52) = &H93CC7314
    m_sBox(3, 52) = &H211A1477
    m_sBox(0, 53) = &HE6AD2065
    m_sBox(1, 53) = &H77B5FA86
    m_sBox(2, 53) = &HC75442F5
    m_sBox(3, 53) = &HFB9D35CF
    m_sBox(0, 54) = &HEBCDAF0C
    m_sBox(1, 54) = &H7B3E89A0
    m_sBox(2, 54) = &HD6411BD3
    m_sBox(3, 54) = &HAE1E7E49
    m_sBox(0, 55) = &H250E2D
    m_sBox(1, 55) = &H2071B35E
    m_sBox(2, 55) = &H226800BB
    m_sBox(3, 55) = &H57B8E0AF
    m_sBox(0, 56) = &H2464369B
    m_sBox(1, 56) = &HF009B91E
    m_sBox(2, 56) = &H5563911D
    m_sBox(3, 56) = &H59DFA6AA
    m_sBox(0, 57) = &H78C14389
    m_sBox(1, 57) = &HD95A537F
    m_sBox(2, 57) = &H207D5BA2
    m_sBox(3, 57) = &H2E5B9C5
    m_sBox(0, 58) = &H83260376
    m_sBox(1, 58) = &H6295CFA9
    m_sBox(2, 58) = &H11C81968
    m_sBox(3, 58) = &H4E734A41
    m_sBox(0, 59) = &HB3472DCA
    m_sBox(1, 59) = &H7B14A94A
    m_sBox(2, 59) = &H1B510052
    m_sBox(3, 59) = &H9A532915
    m_sBox(0, 60) = &HD60F573F
    m_sBox(1, 60) = &HBC9BC6E4
    m_sBox(2, 60) = &H2B60A476
    m_sBox(3, 60) = &H81E67400
    m_sBox(0, 61) = &H8BA6FB5
    m_sBox(1, 61) = &H571BE91F
    m_sBox(2, 61) = &HF296EC6B
    m_sBox(3, 61) = &H2A0DD915
    m_sBox(0, 62) = &HB6636521
    m_sBox(1, 62) = &HE7B9F9B6
    m_sBox(2, 62) = &HFF34052E
    m_sBox(3, 62) = &HC5855664
    m_sBox(0, 63) = &H53B02D5D
    m_sBox(1, 63) = &HA99F8FA1
    m_sBox(2, 63) = &H8BA4799
    m_sBox(3, 63) = &H6E85076A
    m_sBox(0, 64) = &H4B7A70E9
    m_sBox(1, 64) = &HB5B32944
    m_sBox(2, 64) = &HDB75092E
    m_sBox(3, 64) = &HC4192623
    m_sBox(0, 65) = &HAD6EA6B0
    m_sBox(1, 65) = &H49A7DF7D
    m_sBox(2, 65) = &H9CEE60B8
    m_sBox(3, 65) = &H8FEDB266
    m_sBox(0, 66) = &HECAA8C71
    m_sBox(1, 66) = &H699A17FF
    m_sBox(2, 66) = &H5664526C
    m_sBox(3, 66) = &HC2B19EE1
    m_sBox(0, 67) = &H193602A5
    m_sBox(1, 67) = &H75094C29
    m_sBox(2, 67) = &HA0591340
    m_sBox(3, 67) = &HE4183A3E
    m_sBox(0, 68) = &H3F54989A
    m_sBox(1, 68) = &H5B429D65
    m_sBox(2, 68) = &H6B8FE4D6
    m_sBox(3, 68) = &H99F73FD6
    m_sBox(0, 69) = &HA1D29C07
    m_sBox(1, 69) = &HEFE830F5
    m_sBox(2, 69) = &H4D2D38E6
    m_sBox(3, 69) = &HF0255DC1
    m_sBox(0, 70) = &H4CDD2086
    m_sBox(1, 70) = &H8470EB26
    m_sBox(2, 70) = &H6382E9C6
    m_sBox(3, 70) = &H21ECC5E
    m_sBox(0, 71) = &H9686B3F
    m_sBox(1, 71) = &H3EBAEFC9
    m_sBox(2, 71) = &H3C971814
    m_sBox(3, 71) = &H6B6A70A1
    m_sBox(0, 72) = &H687F3584
    m_sBox(1, 72) = &H52A0E286
    m_sBox(2, 72) = &HB79C5305
    m_sBox(3, 72) = &HAA500737
    m_sBox(0, 73) = &H3E07841C
    m_sBox(1, 73) = &H7FDEAE5C
    m_sBox(2, 73) = &H8E7D44EC
    m_sBox(3, 73) = &H5716F2B8
    m_sBox(0, 74) = &HB03ADA37
    m_sBox(1, 74) = &HF0500C0D
    m_sBox(2, 74) = &HF01C1F04
    m_sBox(3, 74) = &H200B3FF
    m_sBox(0, 75) = &HAE0CF51A
    m_sBox(1, 75) = &H3CB574B2
    m_sBox(2, 75) = &H25837A58
    m_sBox(3, 75) = &HDC0921BD
    m_sBox(0, 76) = &HD19113F9
    m_sBox(1, 76) = &H7CA92FF6
    m_sBox(2, 76) = &H94324773
    m_sBox(3, 76) = &H22F54701
    m_sBox(0, 77) = &H3AE5E581
    m_sBox(1, 77) = &H37C2DADC
    m_sBox(2, 77) = &HC8B57634
    m_sBox(3, 77) = &H9AF3DDA7
    m_sBox(0, 78) = &HA9446146
    m_sBox(1, 78) = &HFD0030E
    m_sBox(2, 78) = &HECC8C73E
    m_sBox(3, 78) = &HA4751E41
    m_sBox(0, 79) = &HE238CD99
    m_sBox(1, 79) = &H3BEA0E2F
    m_sBox(2, 79) = &H3280BBA1
    m_sBox(3, 79) = &H183EB331
    m_sBox(0, 80) = &H4E548B38
    m_sBox(1, 80) = &H4F6DB908
    m_sBox(2, 80) = &H6F420D03
    m_sBox(3, 80) = &HF60A04BF
    m_sBox(0, 81) = &H2CB81290
    m_sBox(1, 81) = &H24977C79
    m_sBox(2, 81) = &H5679B072
    m_sBox(3, 81) = &HBCAF89AF
    m_sBox(0, 82) = &HDE9A771F
    m_sBox(1, 82) = &HD9930810
    m_sBox(2, 82) = &HB38BAE12
    m_sBox(3, 82) = &HDCCF3F2E
    m_sBox(0, 83) = &H5512721F
    m_sBox(1, 83) = &H2E6B7124
    m_sBox(2, 83) = &H501ADDE6
    m_sBox(3, 83) = &H9F84CD87
    m_sBox(0, 84) = &H7A584718
    m_sBox(1, 84) = &H7408DA17
    m_sBox(2, 84) = &HBC9F9ABC
    m_sBox(3, 84) = &HE94B7D8C
    m_sBox(0, 85) = &HEC7AEC3A
    m_sBox(1, 85) = &HDB851DFA
    m_sBox(2, 85) = &H63094366
    m_sBox(3, 85) = &HC464C3D2
    m_sBox(0, 86) = &HEF1C1847
    m_sBox(1, 86) = &H3215D908
    m_sBox(2, 86) = &HDD433B37
    m_sBox(3, 86) = &H24C2BA16
    m_sBox(0, 87) = &H12A14D43
    m_sBox(1, 87) = &H2A65C451
    m_sBox(2, 87) = &H50940002
    m_sBox(3, 87) = &H133AE4DD
    m_sBox(0, 88) = &H71DFF89E
    m_sBox(1, 88) = &H10314E55
    m_sBox(2, 88) = &H81AC77D6
    m_sBox(3, 88) = &H5F11199B
    m_sBox(0, 89) = &H43556F1
    m_sBox(1, 89) = &HD7A3C76B
    m_sBox(2, 89) = &H3C11183B
    m_sBox(3, 89) = &H5924A509
    m_sBox(0, 90) = &HF28FE6ED
    m_sBox(1, 90) = &H97F1FBFA
    m_sBox(2, 90) = &H9EBABF2C
    m_sBox(3, 90) = &H1E153C6E
    m_sBox(0, 91) = &H86E34570
    m_sBox(1, 91) = &HEAE96FB1
    m_sBox(2, 91) = &H860E5E0A
    m_sBox(3, 91) = &H5A3E2AB3
    m_sBox(0, 92) = &H771FE71C
    m_sBox(1, 92) = &H4E3D06FA
    m_sBox(2, 92) = &H2965DCB9
    m_sBox(3, 92) = &H99E71D0F
    m_sBox(0, 93) = &H803E89D6
    m_sBox(1, 93) = &H5266C825
    m_sBox(2, 93) = &H2E4CC978
    m_sBox(3, 93) = &H9C10B36A
    m_sBox(0, 94) = &HC6150EBA
    m_sBox(1, 94) = &H94E2EA78
    m_sBox(2, 94) = &HA5FC3C53
    m_sBox(3, 94) = &H1E0A2DF4
    m_sBox(0, 95) = &HF2F74EA7
    m_sBox(1, 95) = &H361D2B3D
    m_sBox(2, 95) = &H1939260F
    m_sBox(3, 95) = &H19C27960
    m_sBox(0, 96) = &H5223A708
    m_sBox(1, 96) = &HF71312B6
    m_sBox(2, 96) = &HEBADFE6E
    m_sBox(3, 96) = &HEAC31F66
    m_sBox(0, 97) = &HE3BC4595
    m_sBox(1, 97) = &HA67BC883
    m_sBox(2, 97) = &HB17F37D1
    m_sBox(3, 97) = &H18CFF28
    m_sBox(0, 98) = &HC332DDEF
    m_sBox(1, 98) = &HBE6C5AA5
    m_sBox(2, 98) = &H65582185
    m_sBox(3, 98) = &H68AB9802
    m_sBox(0, 99) = &HEECEA50F
    m_sBox(1, 99) = &HDB2F953B
    m_sBox(2, 99) = &H2AEF7DAD
    m_sBox(3, 99) = &H5B6E2F84
    m_sBox(0, 100) = &H1521B628
    m_sBox(1, 100) = &H29076170
    m_sBox(2, 100) = &HECDD4775
    m_sBox(3, 100) = &H619F1510
    m_sBox(0, 101) = &H13CCA830
    m_sBox(1, 101) = &HEB61BD96
    m_sBox(2, 101) = &H334FE1E
    m_sBox(3, 101) = &HAA0363CF
    m_sBox(0, 102) = &HB5735C90
    m_sBox(1, 102) = &H4C70A239
    m_sBox(2, 102) = &HD59E9E0B
    m_sBox(3, 102) = &HCBAADE14
    m_sBox(0, 103) = &HEECC86BC
    m_sBox(1, 103) = &H60622CA7
    m_sBox(2, 103) = &H9CAB5CAB
    m_sBox(3, 103) = &HB2F3846E
    m_sBox(0, 104) = &H648B1EAF
    m_sBox(1, 104) = &H19BDF0CA
    m_sBox(2, 104) = &HA02369B9
    m_sBox(3, 104) = &H655ABB50
    m_sBox(0, 105) = &H40685A32
    m_sBox(1, 105) = &H3C2AB4B3
    m_sBox(2, 105) = &H319EE9D5
    m_sBox(3, 105) = &HC021B8F7
    m_sBox(0, 106) = &H9B540B19
    m_sBox(1, 106) = &H875FA099
    m_sBox(2, 106) = &H95F7997E
    m_sBox(3, 106) = &H623D7DA8
    m_sBox(0, 107) = &HF837889A
    m_sBox(1, 107) = &H97E32D77
    m_sBox(2, 107) = &H11ED935F
    m_sBox(3, 107) = &H16681281
    m_sBox(0, 108) = &HE358829
    m_sBox(1, 108) = &HC7E61FD6
    m_sBox(2, 108) = &H96DEDFA1
    m_sBox(3, 108) = &H7858BA99
    m_sBox(0, 109) = &H57F584A5
    m_sBox(1, 109) = &H1B227263
    m_sBox(2, 109) = &H9B83C3FF
    m_sBox(3, 109) = &H1AC24696
    m_sBox(0, 110) = &HCDB30AEB
    m_sBox(1, 110) = &H532E3054
    m_sBox(2, 110) = &H8FD948E4
    m_sBox(3, 110) = &H6DBC3128
    m_sBox(0, 111) = &H58EBF2EF
    m_sBox(1, 111) = &H34C6FFEA
    m_sBox(2, 111) = &HFE28ED61
    m_sBox(3, 111) = &HEE7C3C73
    m_sBox(0, 112) = &H5D4A14D9
    m_sBox(1, 112) = &HE864B7E3
    m_sBox(2, 112) = &H42105D14
    m_sBox(3, 112) = &H203E13E0
    m_sBox(0, 113) = &H45EEE2B6
    m_sBox(1, 113) = &HA3AAABEA
    m_sBox(2, 113) = &HDB6C4F15
    m_sBox(3, 113) = &HFACB4FD0
    m_sBox(0, 114) = &HC742F442
    m_sBox(1, 114) = &HEF6ABBB5
    m_sBox(2, 114) = &H654F3B1D
    m_sBox(3, 114) = &H41CD2105
    m_sBox(0, 115) = &HD81E799E
    m_sBox(1, 115) = &H86854DC7
    m_sBox(2, 115) = &HE44B476A
    m_sBox(3, 115) = &H3D816250
    m_sBox(0, 116) = &HCF62A1F2
    m_sBox(1, 116) = &H5B8D2646
    m_sBox(2, 116) = &HFC8883A0
    m_sBox(3, 116) = &HC1C7B6A3
    m_sBox(0, 117) = &H7F1524C3
    m_sBox(1, 117) = &H69CB7492
    m_sBox(2, 117) = &H47848A0B
    m_sBox(3, 117) = &H5692B285
    m_sBox(0, 118) = &H95BBF00
    m_sBox(1, 118) = &HAD19489D
    m_sBox(2, 118) = &H1462B174
    m_sBox(3, 118) = &H23820E00
    m_sBox(0, 119) = &H58428D2A
    m_sBox(1, 119) = &HC55F5EA
    m_sBox(2, 119) = &H1DADF43E
    m_sBox(3, 119) = &H233F7061
    m_sBox(0, 120) = &H3372F092
    m_sBox(1, 120) = &H8D937E41
    m_sBox(2, 120) = &HD65FECF1
    m_sBox(3, 120) = &H6C223BDB
    m_sBox(0, 121) = &H7CDE3759
    m_sBox(1, 121) = &HCBEE7460
    m_sBox(2, 121) = &H4085F2A7
    m_sBox(3, 121) = &HCE77326E
    m_sBox(0, 122) = &HA6078084
    m_sBox(1, 122) = &H19F8509E
    m_sBox(2, 122) = &HE8EFD855
    m_sBox(3, 122) = &H61D99735
    m_sBox(0, 123) = &HA969A7AA
    m_sBox(1, 123) = &HC50C06C2
    m_sBox(2, 123) = &H5A04ABFC
    m_sBox(3, 123) = &H800BCADC
    m_sBox(0, 124) = &H9E447A2E
    m_sBox(1, 124) = &HC3453484
    m_sBox(2, 124) = &HFDD56705
    m_sBox(3, 124) = &HE1E9EC9
    m_sBox(0, 125) = &HDB73DBD3
    m_sBox(1, 125) = &H105588CD
    m_sBox(2, 125) = &H675FDA79
    m_sBox(3, 125) = &HE3674340
    m_sBox(0, 126) = &HC5C43465
    m_sBox(1, 126) = &H713E38D8
    m_sBox(2, 126) = &H3D28F89E
    m_sBox(3, 126) = &HF16DFF20
    m_sBox(0, 127) = &H153E21E7
    m_sBox(1, 127) = &H8FB03D4A
    m_sBox(2, 127) = &HE6E39F2B
    m_sBox(3, 127) = &HDB83ADF7
    m_sBox(0, 128) = &HE93D5A68
    m_sBox(1, 128) = &H948140F7
    m_sBox(2, 128) = &HF64C261C
    m_sBox(3, 128) = &H94692934
    m_sBox(0, 129) = &H411520F7
    m_sBox(1, 129) = &H7602D4F7
    m_sBox(2, 129) = &HBCF46B2E
    m_sBox(3, 129) = &HD4A20068
    m_sBox(0, 130) = &HD4082471
    m_sBox(1, 130) = &H3320F46A
    m_sBox(2, 130) = &H43B7D4B7
    m_sBox(3, 130) = &H500061AF
    m_sBox(0, 131) = &H1E39F62E
    m_sBox(1, 131) = &H97244546
    m_sBox(2, 131) = &H14214F74
    m_sBox(3, 131) = &HBF8B8840
    m_sBox(0, 132) = &H4D95FC1D
    m_sBox(1, 132) = &H96B591AF
    m_sBox(2, 132) = &H70F4DDD3
    m_sBox(3, 132) = &H66A02F45
    m_sBox(0, 133) = &HBFBC09EC
    m_sBox(1, 133) = &H3BD9785
    m_sBox(2, 133) = &H7FAC6DD0
    m_sBox(3, 133) = &H31CB8504
    m_sBox(0, 134) = &H96EB27B3
    m_sBox(1, 134) = &H55FD3941
    m_sBox(2, 134) = &HDA2547E6
    m_sBox(3, 134) = &HABCA0A9A
    m_sBox(0, 135) = &H28507825
    m_sBox(1, 135) = &H530429F4
    m_sBox(2, 135) = &HA2C86DA
    m_sBox(3, 135) = &HE9B66DFB
    m_sBox(0, 136) = &H68DC1462
    m_sBox(1, 136) = &HD7486900
    m_sBox(2, 136) = &H680EC0A4
    m_sBox(3, 136) = &H27A18DEE
    m_sBox(0, 137) = &H4F3FFEA2
    m_sBox(1, 137) = &HE887AD8C
    m_sBox(2, 137) = &HB58CE006
    m_sBox(3, 137) = &H7AF4D6B6
    m_sBox(0, 138) = &HAACE1E7C
    m_sBox(1, 138) = &HD3375FEC
    m_sBox(2, 138) = &HCE78A399
    m_sBox(3, 138) = &H406B2A42
    m_sBox(0, 139) = &H20FE9E35
    m_sBox(1, 139) = &HD9F385B9
    m_sBox(2, 139) = &HEE39D7AB
    m_sBox(3, 139) = &H3B124E8B
    m_sBox(0, 140) = &H1DC9FAF7
    m_sBox(1, 140) = &H4B6D1856
    m_sBox(2, 140) = &H26A36631
    m_sBox(3, 140) = &HEAE397B2
    m_sBox(0, 141) = &H3A6EFA74
    m_sBox(1, 141) = &HDD5B4332
    m_sBox(2, 141) = &H6841E7F7
    m_sBox(3, 141) = &HCA7820FB
    m_sBox(0, 142) = &HFB0AF54E
    m_sBox(1, 142) = &HD8FEB397
    m_sBox(2, 142) = &H454056AC
    m_sBox(3, 142) = &HBA489527
    m_sBox(0, 143) = &H55533A3A
    m_sBox(1, 143) = &H20838D87
    m_sBox(2, 143) = &HFE6BA9B7
    m_sBox(3, 143) = &HD096954B
    m_sBox(0, 144) = &H55A867BC
    m_sBox(1, 144) = &HA1159A58
    m_sBox(2, 144) = &HCCA92963
    m_sBox(3, 144) = &H99E1DB33
    m_sBox(0, 145) = &HA62A4A56
    m_sBox(1, 145) = &H3F3125F9
    m_sBox(2, 145) = &H5EF47E1C
    m_sBox(3, 145) = &H9029317C
    m_sBox(0, 146) = &HFDF8E802
    m_sBox(1, 146) = &H4272F70
    m_sBox(2, 146) = &H80BB155C
    m_sBox(3, 146) = &H5282CE3
    m_sBox(0, 147) = &H95C11548
    m_sBox(1, 147) = &HE4C66D22
    m_sBox(2, 147) = &H48C1133F
    m_sBox(3, 147) = &HC70F86DC
    m_sBox(0, 148) = &H7F9C9EE
    m_sBox(1, 148) = &H41041F0F
    m_sBox(2, 148) = &H404779A4
    m_sBox(3, 148) = &H5D886E17
    m_sBox(0, 149) = &H325F51EB
    m_sBox(1, 149) = &HD59BC0D1
    m_sBox(2, 149) = &HF2BCC18F
    m_sBox(3, 149) = &H41113564
    m_sBox(0, 150) = &H257B7834
    m_sBox(1, 150) = &H602A9C60
    m_sBox(2, 150) = &HDFF8E8A3
    m_sBox(3, 150) = &H1F636C1B
    m_sBox(0, 151) = &HE12B4C2
    m_sBox(1, 151) = &H2E1329E
    m_sBox(2, 151) = &HAF664FD1
    m_sBox(3, 151) = &HCAD18115
    m_sBox(0, 152) = &H6B2395E0
    m_sBox(1, 152) = &H333E92E1
    m_sBox(2, 152) = &H3B240B62
    m_sBox(3, 152) = &HEEBEB922
    m_sBox(0, 153) = &H85B2A20E
    m_sBox(1, 153) = &HE6BA0D99
    m_sBox(2, 153) = &HDE720C8C
    m_sBox(3, 153) = &H2DA2F728
    m_sBox(0, 154) = &HD0127845
    m_sBox(1, 154) = &H95B794FD
    m_sBox(2, 154) = &H647D0862
    m_sBox(3, 154) = &HE7CCF5F0
    m_sBox(0, 155) = &H5449A36F
    m_sBox(1, 155) = &H877D48FA
    m_sBox(2, 155) = &HC39DFD27
    m_sBox(3, 155) = &HF33E8D1E
    m_sBox(0, 156) = &HA476341
    m_sBox(1, 156) = &H992EFF74
    m_sBox(2, 156) = &H3A6F6EAB
    m_sBox(3, 156) = &HF4F8FD37
    m_sBox(0, 157) = &HA812DC60
    m_sBox(1, 157) = &HA1EBDDF8
    m_sBox(2, 157) = &H991BE14C
    m_sBox(3, 157) = &HDB6E6B0D
    m_sBox(0, 158) = &HC67B5510
    m_sBox(1, 158) = &H6D672C37
    m_sBox(2, 158) = &H2765D43B
    m_sBox(3, 158) = &HDCD0E804
    m_sBox(0, 159) = &HF1290DC7
    m_sBox(1, 159) = &HCC00FFA3
    m_sBox(2, 159) = &HB5390F92
    m_sBox(3, 159) = &H690FED0B
    m_sBox(0, 160) = &H667B9FFB
    m_sBox(1, 160) = &HCEDB7D9C
    m_sBox(2, 160) = &HA091CF0B
    m_sBox(3, 160) = &HD9155EA3
    m_sBox(0, 161) = &HBB132F88
    m_sBox(1, 161) = &H515BAD24
    m_sBox(2, 161) = &H7B9479BF
    m_sBox(3, 161) = &H763BD6EB
    m_sBox(0, 162) = &H37392EB3
    m_sBox(1, 162) = &HCC115979
    m_sBox(2, 162) = &H8026E297
    m_sBox(3, 162) = &HF42E312D
    m_sBox(0, 163) = &H6842ADA7
    m_sBox(1, 163) = &HC66A2B3B
    m_sBox(2, 163) = &H12754CCC
    m_sBox(3, 163) = &H782EF11C
    m_sBox(0, 164) = &H6A124237
    m_sBox(1, 164) = &HB79251E7
    m_sBox(2, 164) = &H6A1BBE6
    m_sBox(3, 164) = &H4BFB6350
    m_sBox(0, 165) = &H1A6B1018
    m_sBox(1, 165) = &H11CAEDFA
    m_sBox(2, 165) = &H3D25BDD8
    m_sBox(3, 165) = &HE2E1C3C9
    m_sBox(0, 166) = &H44421659
    m_sBox(1, 166) = &HA121386
    m_sBox(2, 166) = &HD90CEC6E
    m_sBox(3, 166) = &HD5ABEA2A
    m_sBox(0, 167) = &H64AF674E
    m_sBox(1, 167) = &HDA86A85F
    m_sBox(2, 167) = &HBEBFE988
    m_sBox(3, 167) = &H64E4C3FE
    m_sBox(0, 168) = &H9DBC8057
    m_sBox(1, 168) = &HF0F7C086
    m_sBox(2, 168) = &H60787BF8
    m_sBox(3, 168) = &H6003604D
    m_sBox(0, 169) = &HD1FD8346
    m_sBox(1, 169) = &HF6381FB0
    m_sBox(2, 169) = &H7745AE04
    m_sBox(3, 169) = &HD736FCCC
    m_sBox(0, 170) = &H83426B33
    m_sBox(1, 170) = &HF01EAB71
    m_sBox(2, 170) = &HB0804187
    m_sBox(3, 170) = &H3C005E5F
    m_sBox(0, 171) = &H77A057BE
    m_sBox(1, 171) = &HBDE8AE24
    m_sBox(2, 171) = &H55464299
    m_sBox(3, 171) = &HBF582E61
    m_sBox(0, 172) = &H4E58F48F
    m_sBox(1, 172) = &HF2DDFDA2
    m_sBox(2, 172) = &HF474EF38
    m_sBox(3, 172) = &H8789BDC2
    m_sBox(0, 173) = &H5366F9C3
    m_sBox(1, 173) = &HC8B38E74
    m_sBox(2, 173) = &HB475F255
    m_sBox(3, 173) = &H46FCD9B9
    m_sBox(0, 174) = &H7AEB2661
    m_sBox(1, 174) = &H8B1DDF84
    m_sBox(2, 174) = &H846A0E79
    m_sBox(3, 174) = &H915F95E2
    m_sBox(0, 175) = &H466E598E
    m_sBox(1, 175) = &H20B45770
    m_sBox(2, 175) = &H8CD55591
    m_sBox(3, 175) = &HC902DE4C
    m_sBox(0, 176) = &HB90BACE1
    m_sBox(1, 176) = &HBB8205D0
    m_sBox(2, 176) = &H11A86248
    m_sBox(3, 176) = &H7574A99E
    m_sBox(0, 177) = &HB77F19B6
    m_sBox(1, 177) = &HE0A9DC09
    m_sBox(2, 177) = &H662D09A1
    m_sBox(3, 177) = &HC4324633
    m_sBox(0, 178) = &HE85A1F02
    m_sBox(1, 178) = &H9F0BE8C
    m_sBox(2, 178) = &H4A99A025
    m_sBox(3, 178) = &H1D6EFE10
    m_sBox(0, 179) = &H1AB93D1D
    m_sBox(1, 179) = &HBA5A4DF
    m_sBox(2, 179) = &HA186F20F
    m_sBox(3, 179) = &H2868F169
    m_sBox(0, 180) = &HDCB7DA83
    m_sBox(1, 180) = &H573906FE
    m_sBox(2, 180) = &HA1E2CE9B
    m_sBox(3, 180) = &H4FCD7F52
    m_sBox(0, 181) = &H50115E01
    m_sBox(1, 181) = &HA70683FA
    m_sBox(2, 181) = &HA002B5C4
    m_sBox(3, 181) = &HDE6D027
    m_sBox(0, 182) = &H9AF88C27
    m_sBox(1, 182) = &H773F8641
    m_sBox(2, 182) = &HC3604C06
    m_sBox(3, 182) = &H61A806B5
    m_sBox(0, 183) = &HF0177A28
    m_sBox(1, 183) = &HC0F586E0
    m_sBox(2, 183) = &H6058AA
    m_sBox(3, 183) = &H30DC7D62
    m_sBox(0, 184) = &H11E69ED7
    m_sBox(1, 184) = &H2338EA63
    m_sBox(2, 184) = &H53C2DD94
    m_sBox(3, 184) = &HC2C21634
    m_sBox(0, 185) = &HBBCBEE56
    m_sBox(1, 185) = &H90BCB6DE
    m_sBox(2, 185) = &HEBFC7DA1
    m_sBox(3, 185) = &HCE591D76
    m_sBox(0, 186) = &H6F05E409
    m_sBox(1, 186) = &H4B7C0188
    m_sBox(2, 186) = &H39720A3D
    m_sBox(3, 186) = &H7C927C24
    m_sBox(0, 187) = &H86E3725F
    m_sBox(1, 187) = &H724D9DB9
    m_sBox(2, 187) = &H1AC15BB4
    m_sBox(3, 187) = &HD39EB8FC
    m_sBox(0, 188) = &HED545578
    m_sBox(1, 188) = &H8FCA5B5
    m_sBox(2, 188) = &HD83D7CD3
    m_sBox(3, 188) = &H4DAD0FC4
    m_sBox(0, 189) = &H1E50EF5E
    m_sBox(1, 189) = &HB161E6F8
    m_sBox(2, 189) = &HA28514D9
    m_sBox(3, 189) = &H6C51133C
    m_sBox(0, 190) = &H6FD5C7E7
    m_sBox(1, 190) = &H56E14EC4
    m_sBox(2, 190) = &H362ABFCE
    m_sBox(3, 190) = &HDDC6C837
    m_sBox(0, 191) = &HD79A3234
    m_sBox(1, 191) = &H92638212
    m_sBox(2, 191) = &H670EFA8E
    m_sBox(3, 191) = &H406000E0
    m_sBox(0, 192) = &H3A39CE37
    m_sBox(1, 192) = &HD3FAF5CF
    m_sBox(2, 192) = &HABC27737
    m_sBox(3, 192) = &H5AC52D1B
    m_sBox(0, 193) = &H5CB0679E
    m_sBox(1, 193) = &H4FA33742
    m_sBox(2, 193) = &HD3822740
    m_sBox(3, 193) = &H99BC9BBE
    m_sBox(0, 194) = &HD5118E9D
    m_sBox(1, 194) = &HBF0F7315
    m_sBox(2, 194) = &HD62D1C7E
    m_sBox(3, 194) = &HC700C47B
    m_sBox(0, 195) = &HB78C1B6B
    m_sBox(1, 195) = &H21A19045
    m_sBox(2, 195) = &HB26EB1BE
    m_sBox(3, 195) = &H6A366EB4
    m_sBox(0, 196) = &H5748AB2F
    m_sBox(1, 196) = &HBC946E79
    m_sBox(2, 196) = &HC6A376D2
    m_sBox(3, 196) = &H6549C2C8
    m_sBox(0, 197) = &H530FF8EE
    m_sBox(1, 197) = &H468DDE7D
    m_sBox(2, 197) = &HD5730A1D
    m_sBox(3, 197) = &H4CD04DC6
    m_sBox(0, 198) = &H2939BBDB
    m_sBox(1, 198) = &HA9BA4650
    m_sBox(2, 198) = &HAC9526E8
    m_sBox(3, 198) = &HBE5EE304
    m_sBox(0, 199) = &HA1FAD5F0
    m_sBox(1, 199) = &H6A2D519A
    m_sBox(2, 199) = &H63EF8CE2
    m_sBox(3, 199) = &H9A86EE22
    m_sBox(0, 200) = &HC089C2B8
    m_sBox(1, 200) = &H43242EF6
    m_sBox(2, 200) = &HA51E03AA
    m_sBox(3, 200) = &H9CF2D0A4
    m_sBox(0, 201) = &H83C061BA
    m_sBox(1, 201) = &H9BE96A4D
    m_sBox(2, 201) = &H8FE51550
    m_sBox(3, 201) = &HBA645BD6
    m_sBox(0, 202) = &H2826A2F9
    m_sBox(1, 202) = &HA73A3AE1
    m_sBox(2, 202) = &H4BA99586
    m_sBox(3, 202) = &HEF5562E9
    m_sBox(0, 203) = &HC72FEFD3
    m_sBox(1, 203) = &HF752F7DA
    m_sBox(2, 203) = &H3F046F69
    m_sBox(3, 203) = &H77FA0A59
    m_sBox(0, 204) = &H80E4A915
    m_sBox(1, 204) = &H87B08601
    m_sBox(2, 204) = &H9B09E6AD
    m_sBox(3, 204) = &H3B3EE593
    m_sBox(0, 205) = &HE990FD5A
    m_sBox(1, 205) = &H9E34D797
    m_sBox(2, 205) = &H2CF0B7D9
    m_sBox(3, 205) = &H22B8B51
    m_sBox(0, 206) = &H96D5AC3A
    m_sBox(1, 206) = &H17DA67D
    m_sBox(2, 206) = &HD1CF3ED6
    m_sBox(3, 206) = &H7C7D2D28
    m_sBox(0, 207) = &H1F9F25CF
    m_sBox(1, 207) = &HADF2B89B
    m_sBox(2, 207) = &H5AD6B472
    m_sBox(3, 207) = &H5A88F54C
    m_sBox(0, 208) = &HE029AC71
    m_sBox(1, 208) = &HE019A5E6
    m_sBox(2, 208) = &H47B0ACFD
    m_sBox(3, 208) = &HED93FA9B
    m_sBox(0, 209) = &HE8D3C48D
    m_sBox(1, 209) = &H283B57CC
    m_sBox(2, 209) = &HF8D56629
    m_sBox(3, 209) = &H79132E28
    m_sBox(0, 210) = &H785F0191
    m_sBox(1, 210) = &HED756055
    m_sBox(2, 210) = &HF7960E44
    m_sBox(3, 210) = &HE3D35E8C
    m_sBox(0, 211) = &H15056DD4
    m_sBox(1, 211) = &H88F46DBA
    m_sBox(2, 211) = &H3A16125
    m_sBox(3, 211) = &H564F0BD
    m_sBox(0, 212) = &HC3EB9E15
    m_sBox(1, 212) = &H3C9057A2
    m_sBox(2, 212) = &H97271AEC
    m_sBox(3, 212) = &HA93A072A
    m_sBox(0, 213) = &H1B3F6D9B
    m_sBox(1, 213) = &H1E6321F5
    m_sBox(2, 213) = &HF59C66FB
    m_sBox(3, 213) = &H26DCF319
    m_sBox(0, 214) = &H7533D928
    m_sBox(1, 214) = &HB155FDF5
    m_sBox(2, 214) = &H3563482
    m_sBox(3, 214) = &H8ABA3CBB
    m_sBox(0, 215) = &H28517711
    m_sBox(1, 215) = &HC20AD9F8
    m_sBox(2, 215) = &HABCC5167
    m_sBox(3, 215) = &HCCAD925F
    m_sBox(0, 216) = &H4DE81751
    m_sBox(1, 216) = &H3830DC8E
    m_sBox(2, 216) = &H379D5862
    m_sBox(3, 216) = &H9320F991
    m_sBox(0, 217) = &HEA7A90C2
    m_sBox(1, 217) = &HFB3E7BCE
    m_sBox(2, 217) = &H5121CE64
    m_sBox(3, 217) = &H774FBE32
    m_sBox(0, 218) = &HA8B6E37E
    m_sBox(1, 218) = &HC3293D46
    m_sBox(2, 218) = &H48DE5369
    m_sBox(3, 218) = &H6413E680
    m_sBox(0, 219) = &HA2AE0810
    m_sBox(1, 219) = &HDD6DB224
    m_sBox(2, 219) = &H69852DFD
    m_sBox(3, 219) = &H9072166
    m_sBox(0, 220) = &HB39A460A
    m_sBox(1, 220) = &H6445C0DD
    m_sBox(2, 220) = &H586CDECF
    m_sBox(3, 220) = &H1C20C8AE
    m_sBox(0, 221) = &H5BBEF7DD
    m_sBox(1, 221) = &H1B588D40
    m_sBox(2, 221) = &HCCD2017F
    m_sBox(3, 221) = &H6BB4E3BB
    m_sBox(0, 222) = &HDDA26A7E
    m_sBox(1, 222) = &H3A59FF45
    m_sBox(2, 222) = &H3E350A44
    m_sBox(3, 222) = &HBCB4CDD5
    m_sBox(0, 223) = &H72EACEA8
    m_sBox(1, 223) = &HFA6484BB
    m_sBox(2, 223) = &H8D6612AE
    m_sBox(3, 223) = &HBF3C6F47
    m_sBox(0, 224) = &HD29BE463
    m_sBox(1, 224) = &H542F5D9E
    m_sBox(2, 224) = &HAEC2771B
    m_sBox(3, 224) = &HF64E6370
    m_sBox(0, 225) = &H740E0D8D
    m_sBox(1, 225) = &HE75B1357
    m_sBox(2, 225) = &HF8721671
    m_sBox(3, 225) = &HAF537D5D
    m_sBox(0, 226) = &H4040CB08
    m_sBox(1, 226) = &H4EB4E2CC
    m_sBox(2, 226) = &H34D2466A
    m_sBox(3, 226) = &H115AF84
    m_sBox(0, 227) = &HE1B00428
    m_sBox(1, 227) = &H95983A1D
    m_sBox(2, 227) = &H6B89FB4
    m_sBox(3, 227) = &HCE6EA048
    m_sBox(0, 228) = &H6F3F3B82
    m_sBox(1, 228) = &H3520AB82
    m_sBox(2, 228) = &H11A1D4B
    m_sBox(3, 228) = &H277227F8
    m_sBox(0, 229) = &H611560B1
    m_sBox(1, 229) = &HE7933FDC
    m_sBox(2, 229) = &HBB3A792B
    m_sBox(3, 229) = &H344525BD
    m_sBox(0, 230) = &HA08839E1
    m_sBox(1, 230) = &H51CE794B
    m_sBox(2, 230) = &H2F32C9B7
    m_sBox(3, 230) = &HA01FBAC9
    m_sBox(0, 231) = &HE01CC87E
    m_sBox(1, 231) = &HBCC7D1F6
    m_sBox(2, 231) = &HCF0111C3
    m_sBox(3, 231) = &HA1E8AAC7
    m_sBox(0, 232) = &H1A908749
    m_sBox(1, 232) = &HD44FBD9A
    m_sBox(2, 232) = &HD0DADECB
    m_sBox(3, 232) = &HD50ADA38
    m_sBox(0, 233) = &H339C32A
    m_sBox(1, 233) = &HC6913667
    m_sBox(2, 233) = &H8DF9317C
    m_sBox(3, 233) = &HE0B12B4F
    m_sBox(0, 234) = &HF79E59B7
    m_sBox(1, 234) = &H43F5BB3A
    m_sBox(2, 234) = &HF2D519FF
    m_sBox(3, 234) = &H27D9459C
    m_sBox(0, 235) = &HBF97222C
    m_sBox(1, 235) = &H15E6FC2A
    m_sBox(2, 235) = &HF91FC71
    m_sBox(3, 235) = &H9B941525
    m_sBox(0, 236) = &HFAE59361
    m_sBox(1, 236) = &HCEB69CEB
    m_sBox(2, 236) = &HC2A86459
    m_sBox(3, 236) = &H12BAA8D1
    m_sBox(0, 237) = &HB6C1075E
    m_sBox(1, 237) = &HE3056A0C
    m_sBox(2, 237) = &H10D25065
    m_sBox(3, 237) = &HCB03A442
    m_sBox(0, 238) = &HE0EC6E0E
    m_sBox(1, 238) = &H1698DB3B
    m_sBox(2, 238) = &H4C98A0BE
    m_sBox(3, 238) = &H3278E964
    m_sBox(0, 239) = &H9F1F9532
    m_sBox(1, 239) = &HE0D392DF
    m_sBox(2, 239) = &HD3A0342B
    m_sBox(3, 239) = &H8971F21E
    m_sBox(0, 240) = &H1B0A7441
    m_sBox(1, 240) = &H4BA3348C
    m_sBox(2, 240) = &HC5BE7120
    m_sBox(3, 240) = &HC37632D8
    m_sBox(0, 241) = &HDF359F8D
    m_sBox(1, 241) = &H9B992F2E
    m_sBox(2, 241) = &HE60B6F47
    m_sBox(3, 241) = &HFE3F11D
    m_sBox(0, 242) = &HE54CDA54
    m_sBox(1, 242) = &H1EDAD891
    m_sBox(2, 242) = &HCE6279CF
    m_sBox(3, 242) = &HCD3E7E6F
    m_sBox(0, 243) = &H1618B166
    m_sBox(1, 243) = &HFD2C1D05
    m_sBox(2, 243) = &H848FD2C5
    m_sBox(3, 243) = &HF6FB2299
    m_sBox(0, 244) = &HF523F357
    m_sBox(1, 244) = &HA6327623
    m_sBox(2, 244) = &H93A83531
    m_sBox(3, 244) = &H56CCCD02
    m_sBox(0, 245) = &HACF08162
    m_sBox(1, 245) = &H5A75EBB5
    m_sBox(2, 245) = &H6E163697
    m_sBox(3, 245) = &H88D273CC
    m_sBox(0, 246) = &HDE966292
    m_sBox(1, 246) = &H81B949D0
    m_sBox(2, 246) = &H4C50901B
    m_sBox(3, 246) = &H71C65614
    m_sBox(0, 247) = &HE6C6C7BD
    m_sBox(1, 247) = &H327A140A
    m_sBox(2, 247) = &H45E1D006
    m_sBox(3, 247) = &HC3F27B9A
    m_sBox(0, 248) = &HC9AA53FD
    m_sBox(1, 248) = &H62A80F00
    m_sBox(2, 248) = &HBB25BFE2
    m_sBox(3, 248) = &H35BDD2F6
    m_sBox(0, 249) = &H71126905
    m_sBox(1, 249) = &HB2040222
    m_sBox(2, 249) = &HB6CBCF7C
    m_sBox(3, 249) = &HCD769C2B
    m_sBox(0, 250) = &H53113EC0
    m_sBox(1, 250) = &H1640E3D3
    m_sBox(2, 250) = &H38ABBD60
    m_sBox(3, 250) = &H2547ADF0
    m_sBox(0, 251) = &HBA38209C
    m_sBox(1, 251) = &HF746CE76
    m_sBox(2, 251) = &H77AFA1C5
    m_sBox(3, 251) = &H20756060
    m_sBox(0, 252) = &H85CBFE4E
    m_sBox(1, 252) = &H8AE88DD8
    m_sBox(2, 252) = &H7AAAF9B0
    m_sBox(3, 252) = &H4CF9AA7E
    m_sBox(0, 253) = &H1948C25C
    m_sBox(1, 253) = &H2FB8A8C
    m_sBox(2, 253) = &H1C36AE4
    m_sBox(3, 253) = &HD6EBE1F9
    m_sBox(0, 254) = &H90D4F869
    m_sBox(1, 254) = &HA65CDEA0
    m_sBox(2, 254) = &H3F09252D
    m_sBox(3, 254) = &HC208E69F
    m_sBox(0, 255) = &HB74E6132
    m_sBox(1, 255) = &HCE77E25B
    m_sBox(2, 255) = &H578FDFE3
    m_sBox(3, 255) = &H3AC372E6

    END SUB

    SUB GetWord(LongValue AS LONG, CryptBuffer() AS BYTE, Offset AS LONG)

    ' Call copymemory(LongValue, CryptBuffer(Offset), 4)

    DIM bb(3) AS BYTE

    bb(3) = CryptBuffer(Offset)
    bb(2) = CryptBuffer(Offset + 1)
    bb(1) = CryptBuffer(Offset + 2)
    bb(0) = CryptBuffer(Offset + 3)
    CALL copymemory(VARPTR(LongValue), VARPTR(bb(0)), 4)

    END SUB

    SUB PutWord(LongValue AS LONG, CryptBuffer() AS BYTE, Offset AS LONG)

    ' Call copymemory(CryptBuffer(Offset), LongValue, 4)

    DIM bb(3) AS BYTE

    CALL copymemory(VARPTR(bb(0)), VARPTR(LongValue), 4)
    CryptBuffer(Offset) = bb(3)
    CryptBuffer(Offset + 1) = bb(2)
    CryptBuffer(Offset + 2) = bb(1)
    CryptBuffer(Offset + 3) = bb(0)

    END SUB

    SUB BFKey(New_Value AS STRING)

    DIM i AS LONG
    DIM j AS LONG
    DIM K AS LONG
    DIM dataX AS LONG
    DIM datal AS LONG
    DIM datar AS LONG
    DIM Key(0) AS BYTE
    DIM KeyLength AS LONG
    DIM pos AS LONG

    'Do nothing if the key is buffered
    IF (m_KeyValue = New_Value) THEN EXIT SUB
    BFClass_Initialize
    m_KeyValue = New_Value

    'Convert the new key into a bytearray
    KeyLength = LEN(New_Value)
    StrArrConv New_Value, Key()
    'Create key-dependant p-boxes

    j = 0
    FOR i = 0 TO (%ROUNDS + 1)
    dataX = 0
    FOR K = 0 TO 3
    pos=VARPTR(dataX)+1
    CALL CopyMemory(BYVAL VARPTR(pos), VARPTR(dataX), 3)
    ' In VB CALL CopyMem(byval VARPTR(dataX)+1, VARPTR(dataX), 3)

    dataX = (uw_ShiftLeftBy8(dataX) OR Key(j))
    j = j + 1
    IF (j >= KeyLength) THEN j = 0
    NEXT
    m_pBox(i) = m_pBox(i) XOR dataX
    NEXT

    datal = 0
    datar = 0
    FOR i = 0 TO (%ROUNDS + 1) STEP 2
    CALL BFEncryptBlock(datal, datar)
    m_pBox(i) = datal
    m_pBox(i + 1) = datar
    NEXT

    'Create key-dependant s-boxes
    FOR i = 0 TO 3
    FOR j = 0 TO 255 STEP 2
    CALL BFEncryptBlock(datal, datar)
    m_sBox(i, j) = datal
    m_sBox(i, j + 1) = datar
    NEXT
    NEXT

    END SUB

    FUNCTION uw_ShiftLeftBy8(wordX AS LONG) AS LONG
    DIM temp AS LONG
    ' Shift 32-bit long value to left by 8 bits
    ' i.e. VB equivalent of "wordX << 8" in C
    ' Avoiding problem with sign bit
    temp = (wordX AND &H7FFFFF) * &H100
    IF (wordX AND &H800000) <> 0 THEN
    temp = temp OR &H80000000
    END IF
    FUNCTION=temp
    END FUNCTION


    ------------------
    Pedro Camargo
    Pedro Camargo

  • #2
    Please replace this function:

    FUNCTION ArrStrConv(temparray() AS BYTE) AS STRING
    DIM u AS LONG
    DIM i AS LONG
    DIM strout AS STRING
    u=UBOUND(temparray)
    strout=PEEK$(VARPTR(temparray(0)), SIZEOF(temparray(0)) * (u-1))
    FUNCTION=strout
    END FUNCTION

    The previous function was very slow processing big files.


    ------------------
    Pedro Camargo
    Pedro Camargo

    Comment


    • #3
      This line must be:

      strout=PEEK$(VARPTR(temparray(0)), SIZEOF(temparray(0)) * (u+1))



      ------------------
      Pedro Camargo
      Pedro Camargo

      Comment


      • #4
        I've been messing around with this and have a comment and a question.

        Comment:
        For anyone using the newer PB compilers, "KEY" is a PB keyword,
        so change it to "sKey" ...

        Question:

        In the SUB "BFEncryptByte", I don't see anywhere that sKey is
        used in generating the ciphertext.
        (Same situation in BFDecryptByte...)

        In fact, the sub contains the following comment:
        Code:
        SUB BFEncryptByte(ByteArray() AS BYTE, sKey AS STRING)
        .
        .
        .
        
        'Set the new key if one was provided
        but there's no code to indicate what sKey should be assigned to.


        I've checked for globals, pointers, and other possibilities, but
        I'm still not seeing anything wrong --

        - Has anyone else used this code and gotten it to work?
        - is there a newer version?

        I'd appreciate hearing from anyone who's got experience with this!

        Thanks,
        -John


        ------------------


        [This message has been edited by John Montenigro (edited November 15, 2006).]

        Comment


        • #5
          http://www.pbcrypto.com/view.php?algorithm=blowfish

          haven't tried this one myself, but so far everything at PBCrypto works.

          ------------------
          Dale

          Oops, wrong place for comment

          [This message has been edited by Dale Yarker (edited November 15, 2006).]
          Dale

          Comment


          • #6
            [CODE]
            '
            'blowfish encryption/decryption
            '------------------------------------
            'original file:
            'http://g]http://www.powerbasic.com/support/forums/smile.gif[/img]and formatted by aleksandr dobrev
            'at 11/27/06 fix bug in bfkey-subrotine
            '============================================================
            #compile exe
            #dim all
            '
            #include "win32api.inc"
            '
            '
            declare function bff(byval x as long) as long
            declare sub strarrconv(strin as string, byref temparray() as byte)
            declare function arrstrconv(temparray() as byte) as string
            declare sub bfencryptbyte(bytearray() as byte, key as string)
            declare sub bfdecryptbyte(bytearray() as byte, key as string)
            declare sub bfdecryptblock(xl as long, xr as long)
            declare sub bfencryptblock(xl as long, xr as long)
            declare function bfencryptstring(texts as string, key as string) as string
            declare function bfdecryptstring(texts as string, key as string) as string
            declare sub bfclass_initialize()
            declare sub bfkey(new_value as string)
            declare function uw_shiftleftby8(wordx as long) as long
            '
            'constant for number of rounds
            %rounds = 16
            '
            'keydependant p-boxes and s-boxes
            global m_pbox() as long
            global m_sbox() as long
            'store buffered key
            global m_keyvalue as string
            '
            '
            'declare sub copymemory lib "kernel32" alias "rtlmovememory" (destination as any, source as any, byval length as long)
            '
            function bff(byval x as long) as long
            dim xb(3) as byte
            '
            call copymemory(varptr(xb(0)), varptr(x), 4)
            bff = (((m_sbox(0, xb(3)) + m_sbox(1, xb(2))) xor m_sbox(2, xb(1))) + m_sbox(3, xb(0)))
            end function
            '
            sub bfencryptblock(xl as long, xr as long) 'blowfish_encipher
            dim i as long
            dim j as long
            dim temp as long
            '
            j = 0
            for i = 0 to (%rounds \ 2 - 1)
            xl = xl xor m_pbox(j)
            xr = xr xor bff(xl)
            xr = xr xor m_pbox(j + 1)
            xl = xl xor bff(xr)
            j = j + 2
            next
            '
            temp = xr
            xr = xl xor m_pbox(%rounds)
            xl = temp xor m_pbox(%rounds + 1)
            end sub
            '
            sub bfdecryptblock(xl as long, xr as long)
            dim i as long
            dim j as long
            dim temp as long
            '
            temp = xr
            xr = xl xor m_pbox(%rounds + 1)
            xl = temp xor m_pbox(%rounds)
            '
            j = %rounds - 2
            for i = 0 to (%rounds \ 2 - 1)
            xl = xl xor bff(xr)
            xr = xr xor m_pbox(j + 1)
            xr = xr xor bff(xl)
            xl = xl xor m_pbox(j)
            j = j - 2
            next
            end sub
            '
            sub bfencryptbyte(bytearray() as byte, key as string)
            dim offset as long
            dim origlen as long
            dim leftword as long
            dim rightword as long
            dim cipherlen as long
            dim cipherleft as long
            dim cipherright as long
            dim currpercent as long
            dim nextpercent as long
            dim seed as long
            '
            'set the new key if one was provided
            '
            'get the size of the original array
            origlen = ubound(bytearray) + 1
            '
            'first we add 12 bytes (4 bytes for the
            'length and 8 bytes for the seed values
            'for the cbc routine), and the ciphertext
            'must be a multiple of 8 bytes
            cipherlen = origlen + 12
            if (cipherlen mod 8 <> 0) then
            cipherlen = cipherlen + 8 - (cipherlen mod 8)
            end if
            '
            redim preserve bytearray(cipherlen - 1)
            '
            call copymemory( varptr(bytearray(12)), varptr(bytearray(0)), origlen)
            '
            'store the length descriptor in bytes [9-12]
            call copymemory(varptr(bytearray(8)), varptr(origlen), 4)
            '
            'store a block of random data in bytes [1-8],
            'these work as seed values for the cbc routine
            'and is used to produce different ciphertext
            'even when encrypting the same data with the
            'same key)
            randomize timer
            seed=clng(2147483647 * rnd())
            call copymemory(varptr(bytearray(0)), varptr(seed), 4) ' psevdo-data, which cause generate each time new sequence in all chain
            seed=clng(2147483647 * rnd())
            call copymemory(varptr(bytearray(4)), varptr(seed), 4) ' psevdo-data, which cause generate each time new sequence in all chain
            'encrypt the data in 64-bit blocks
            for offset = 0 to (cipherlen - 1) step 8
            'get the next block of plaintext
            call getword(leftword, bytearray(), offset)
            call getword(rightword, bytearray(), offset + 4)
            '
            'xor the plaintext with the previous
            'ciphertext (cbc, cipher-block chaining)
            leftword = leftword xor cipherleft
            rightword = rightword xor cipherright
            '
            'encrypt the block
            call bfencryptblock(leftword, rightword)
            '
            'store the block
            call putword(leftword, bytearray(), offset)
            call putword(rightword, bytearray(), offset + 4)
            '
            'store the cipherblock (for cbc)
            cipherleft = leftword
            cipherright = rightword
            next
            end sub
            '
            '
            sub bfdecryptbyte(bytearray() as byte, key as string)
            dim offset as long
            dim origlen as long
            dim leftword as long
            dim rightword as long
            dim cipherlen as long
            dim cipherleft as long
            dim cipherright as long
            dim currpercent as long
            dim nextpercent as long
            '
            'set the new key if one was provided
            '
            'get the size of the ciphertext
            cipherlen = ubound(bytearray) + 1
            '
            'decrypt the data in 64-bit blocks
            for offset = 0 to (cipherlen - 1) step 8
            'get the next block of ciphertext
            call getword(leftword, bytearray(), offset)
            call getword(rightword, bytearray(), offset + 4)
            '
            'decrypt the block
            call bfdecryptblock(leftword, rightword)
            '
            'xor with the previous cipherblock
            leftword = leftword xor cipherleft
            rightword = rightword xor cipherright
            '
            'store the current ciphertext to use
            'xor with the next block plaintext
            call getword(cipherleft, bytearray(), offset)
            call getword(cipherright, bytearray(), offset + 4)
            '
            'store the block
            call putword(leftword, bytearray(), offset)
            call putword(rightword, bytearray(), offset + 4)
            next
            '
            'get the size of the original array
            call copymemory(varptr(origlen), varptr(bytearray(8)), 4)
            '
            'make sure origlen is a reasonable value,
            'if we used the wrong key the next couple
            'of statements could be dangerous (gpf)
            if (cipherlen - origlen > 19) or (cipherlen - origlen < 12) then
            'error
            end if
            '
            'resize the bytearray to hold only the plaintext
            'and not the extra information added by the
            'encryption routine
            call copymemory(varptr(bytearray(0)), varptr(bytearray(12)), origlen)
            redim preserve bytearray(origlen - 1)
            '
            'make sure we return a 100% progress
            end sub
            '
            function bfencryptstring(texts as string, key as string) as string
            dim bytearray() as static byte ' -=alex=- add static
            bfkey key
            'convert the string to a bytearray
            strarrconv texts,bytearray()
            'encrypt the array
            call bfencryptbyte(bytearray(), key)
            'return the encrypted data as a string
            bfencryptstring = arrstrconv(bytearray())
            end function
            '
            function bfdecryptstring(texts as string, key as string) as string
            dim bytearray() as byte
            '
            bfkey key
            'convert the string to a bytearray
            strarrconv texts,bytearray()
            '
            'encrypt the array
            call bfdecryptbyte(bytearray(), key)
            '
            'return the encrypted data as a string
            bfdecryptstring = arrstrconv(bytearray())
            end function
            '
            sub strarrconv(strin as string, byref temparray() as byte)'============================
            local i as dword 'dim i as dword
            '
            redim preserve temparray(len(strin)-1)
            for i=1 to len(strin)
            temparray(i-1)=asc(mid$(strin,i,1))
            next
            end sub
            '------ not ready. need ... time to finish it
            'sub strarrconv(strin as string, byref temparray() as byte)
            ' redim preserve temparray(len(strin)'-1)
            ' poke$ varptr(temparray()) ,strin 'varptr(temparray(lbound(temparray) ))
            'end sub
            '=========================================================================================
            '
            'function arrstrconv(temparray() as byte) as string '=====================================
            ' dim u as dword
            ' dim i as dword
            ' dim strout as string
            ' u=ubound(temparray)
            ' strout="
            ' for i=0 to u
            ' strout=strout+chr$(temparray(i))
            ' next
            ' function=strout
            'end function
            '================ speedy function arrstrconv /* replaced by aleksandr dobrev*/
            function arrstrconv(temparray() as byte) as string
            local lbnd as long
            lbnd=lbound(temparray)
            function=peek$(varptr(temparray(lbnd)),ubound(temparray) - lbnd + 1 )
            end function
            '=========================================================================================
            '
            '
            sub getword(longvalue as long, cryptbuffer() as byte, offset as long)
            '
            ' call copymemory(longvalue, cryptbuffer(offset), 4)
            '
            dim bb(3) as static byte
            '
            bb(3) = cryptbuffer(offset)
            bb(2) = cryptbuffer(offset + 1)
            bb(1) = cryptbuffer(offset + 2)
            bb(0) = cryptbuffer(offset + 3)
            call copymemory(varptr(longvalue), varptr(bb(0)), 4)
            '
            end sub
            '
            sub putword(longvalue as long, cryptbuffer() as byte, offset as long)
            ' call copymemory(cryptbuffer(offset), longvalue, 4)
            '
            dim bb(3) as static byte
            '
            call copymemory(varptr(bb(0)), varptr(longvalue), 4)
            cryptbuffer(offset) = bb(3)
            cryptbuffer(offset + 1) = bb(2)
            cryptbuffer(offset + 2) = bb(1)
            cryptbuffer(offset + 3) = bb(0)
            end sub
            '
            sub bfclass_initialize()
            dim m_pbox(%rounds + 1) as global long
            dim m_sbox(3,255) as global long
            '
            'we need to check if we are running in compiled
            '(exe) mode or in the ide, this will allow us to
            'use optimized code with unsigned integers in
            'compiled mode without any overflow errors when
            'running the code in the ide
            ' on error resume next
            '
            'initialize p-boxes
            m_pbox(0) = &h243f6a88???
            m_pbox(1) = &h85a308d3???
            m_pbox(2) = &h13198a2e???
            m_pbox(3) = &h03707344???
            m_pbox(4) = &ha4093822???
            m_pbox(5) = &h299f31d0???
            m_pbox(6) = &h082efa98???
            m_pbox(7) = &hec4e6c89???
            m_pbox(8) = &h452821e6???
            m_pbox(9) = &h38d01377???
            m_pbox(10) = &hbe5466cf???
            m_pbox(11) = &h34e90c6c???
            m_pbox(12) = &hc0ac29b7???
            m_pbox(13) = &hc97c50dd???
            m_pbox(14) = &h3f84d5b5???
            m_pbox(15) = &hb5470917???
            m_pbox(16) = &h9216d5d9???
            m_pbox(17) = &h8979fb1b???
            '
            'initialize s-boxes
            m_sbox(0, 0) = &hd1310ba6
            m_sbox(1, 0) = &h98dfb5ac
            m_sbox(2, 0) = &h2ffd72db
            m_sbox(3, 0) = &hd01adfb7
            m_sbox(0, 1) = &hb8e1afed
            m_sbox(1, 1) = &h6a267e96
            m_sbox(2, 1) = &hba7c9045
            m_sbox(3, 1) = &hf12c7f99
            m_sbox(0, 2) = &h24a19947
            m_sbox(1, 2) = &hb3916cf7
            m_sbox(2, 2) = &h801f2e2
            m_sbox(3, 2) = &h858efc16
            m_sbox(0, 3) = &h636920d8
            m_sbox(1, 3) = &h71574e69
            m_sbox(2, 3) = &ha458fea3
            m_sbox(3, 3) = &hf4933d7e
            m_sbox(0, 4) = &hd95748f
            m_sbox(1, 4) = &h728eb658
            m_sbox(2, 4) = &h718bcd58
            m_sbox(3, 4) = &h82154aee
            m_sbox(0, 5) = &h7b54a41d
            m_sbox(1, 5) = &hc25a59b5
            m_sbox(2, 5) = &h9c30d539
            m_sbox(3, 5) = &h2af26013
            m_sbox(0, 6) = &hc5d1b023
            m_sbox(1, 6) = &h286085f0
            m_sbox(2, 6) = &hca417918
            m_sbox(3, 6) = &hb8db38ef
            m_sbox(0, 7) = &h8e79dcb0
            m_sbox(1, 7) = &h603a180e
            m_sbox(2, 7) = &h6c9e0e8b
            m_sbox(3, 7) = &hb01e8a3e
            m_sbox(0, 8) = &hd71577c1
            m_sbox(1, 8) = &hbd314b27
            m_sbox(2, 8) = &h78af2fda
            m_sbox(3, 8) = &h55605c60
            m_sbox(0, 9) = &he65525f3
            m_sbox(1, 9) = &haa55ab94
            m_sbox(2, 9) = &h57489862
            m_sbox(3, 9) = &h63e81440
            m_sbox(0, 10) = &h55ca396a
            m_sbox(1, 10) = &h2aab10b6
            m_sbox(2, 10) = &hb4cc5c34
            m_sbox(3, 10) = &h1141e8ce
            m_sbox(0, 11) = &ha15486af
            m_sbox(1, 11) = &h7c72e993
            m_sbox(2, 11) = &hb3ee1411
            m_sbox(3, 11) = &h636fbc2a
            m_sbox(0, 12) = &h2ba9c55d
            m_sbox(1, 12) = &h741831f6
            m_sbox(2, 12) = &hce5c3e16
            m_sbox(3, 12) = &h9b87931e
            m_sbox(0, 13) = &hafd6ba33
            m_sbox(1, 13) = &h6c24cf5c
            m_sbox(2, 13) = &h7a325381
            m_sbox(3, 13) = &h28958677
            m_sbox(0, 14) = &h3b8f4898
            m_sbox(1, 14) = &h6b4bb9af
            m_sbox(2, 14) = &hc4bfe81b
            m_sbox(3, 14) = &h66282193
            m_sbox(0, 15) = &h61d809cc
            m_sbox(1, 15) = &hfb21a991
            m_sbox(2, 15) = &h487cac60
            m_sbox(3, 15) = &h5dec8032
            m_sbox(0, 16) = &hef845d5d
            m_sbox(1, 16) = &he98575b1
            m_sbox(2, 16) = &hdc262302
            m_sbox(3, 16) = &heb651b88
            m_sbox(0, 17) = &h23893e81
            m_sbox(1, 17) = &hd396acc5
            m_sbox(2, 17) = &hf6d6ff3
            m_sbox(3, 17) = &h83f44239
            m_sbox(0, 18) = &h2e0b4482
            m_sbox(1, 18) = &ha4842004
            m_sbox(2, 18) = &h69c8f04a
            m_sbox(3, 18) = &h9e1f9b5e
            m_sbox(0, 19) = &h21c66842
            m_sbox(1, 19) = &hf6e96c9a
            m_sbox(2, 19) = &h670c9c61
            m_sbox(3, 19) = &habd388f0
            m_sbox(0, 20) = &h6a51a0d2
            m_sbox(1, 20) = &hd8542f68
            m_sbox(2, 20) = &h960fa728
            m_sbox(3, 20) = &hab5133a3
            m_sbox(0, 21) = &h6eef0b6c
            m_sbox(1, 21) = &h137a3be4
            m_sbox(2, 21) = &hba3bf050
            m_sbox(3, 21) = &h7efb2a98
            m_sbox(0, 22) = &ha1f1651d
            m_sbox(1, 22) = &h39af0176
            m_sbox(2, 22) = &h66ca593e
            m_sbox(3, 22) = &h82430e88
            m_sbox(0, 23) = &h8cee8619
            m_sbox(1, 23) = &h456f9fb4
            m_sbox(2, 23) = &h7d84a5c3
            m_sbox(3, 23) = &h3b8b5ebe
            m_sbox(0, 24) = &he06f75d8
            m_sbox(1, 24) = &h85c12073
            m_sbox(2, 24) = &h401a449f
            m_sbox(3, 24) = &h56c16aa6
            m_sbox(0, 25) = &h4ed3aa62
            m_sbox(1, 25) = &h363f7706
            m_sbox(2, 25) = &h1bfedf72
            m_sbox(3, 25) = &h429b023d
            m_sbox(0, 26) = &h37d0d724
            m_sbox(1, 26) = &hd00a1248
            m_sbox(2, 26) = &hdb0fead3
            m_sbox(3, 26) = &h49f1c09b
            m_sbox(0, 27) = &h75372c9
            m_sbox(1, 27) = &h80991b7b
            m_sbox(2, 27) = &h25d479d8
            m_sbox(3, 27) = &hf6e8def7
            m_sbox(0, 28) = &he3fe501a
            m_sbox(1, 28) = &hb6794c3b
            m_sbox(2, 28) = &h976ce0bd
            m_sbox(3, 28) = &h4c006ba
            m_sbox(0, 29) = &hc1a94fb6
            m_sbox(1, 29) = &h409f60c4
            m_sbox(2, 29) = &h5e5c9ec2
            m_sbox(3, 29) = &h196a2463
            m_sbox(0, 30) = &h68fb6faf
            m_sbox(1, 30) = &h3e6c53b5
            m_sbox(2, 30) = &h1339b2eb
            m_sbox(3, 30) = &h3b52ec6f
            m_sbox(0, 31) = &h6dfc511f
            m_sbox(1, 31) = &h9b30952c
            m_sbox(2, 31) = &hcc814544
            m_sbox(3, 31) = &haf5ebd09
            m_sbox(0, 32) = &hbee3d004
            m_sbox(1, 32) = &hde334afd
            m_sbox(2, 32) = &h660f2807
            m_sbox(3, 32) = &h192e4bb3
            m_sbox(0, 33) = &hc0cba857
            m_sbox(1, 33) = &h45c8740f
            m_sbox(2, 33) = &hd20b5f39
            m_sbox(3, 33) = &hb9d3fbdb
            m_sbox(0, 34) = &h5579c0bd
            m_sbox(1, 34) = &h1a60320a
            m_sbox(2, 34) = &hd6a100c6
            m_sbox(3, 34) = &h402c7279
            m_sbox(0, 35) = &h679f25fe
            m_sbox(1, 35) = &hfb1fa3cc
            m_sbox(2, 35) = &h8ea5e9f8
            m_sbox(3, 35) = &hdb3222f8
            m_sbox(0, 36) = &h3c7516df
            m_sbox(1, 36) = &hfd616b15
            m_sbox(2, 36) = &h2f501ec8
            m_sbox(3, 36) = &had0552ab
            m_sbox(0, 37) = &h323db5fa
            m_sbox(1, 37) = &hfd238760
            m_sbox(2, 37) = &h53317b48
            m_sbox(3, 37) = &h3e00df82
            m_sbox(0, 38) = &h9e5c57bb
            m_sbox(1, 38) = &hca6f8ca0
            m_sbox(2, 38) = &h1a87562e
            m_sbox(3, 38) = &hdf1769db
            m_sbox(0, 39) = &hd542a8f6
            m_sbox(1, 39) = &h287effc3
            m_sbox(2, 39) = &hac6732c6
            m_sbox(3, 39) = &h8c4f5573
            m_sbox(0, 40) = &h695b27b0
            m_sbox(1, 40) = &hbbca58c8
            m_sbox(2, 40) = &he1ffa35d
            m_sbox(3, 40) = &hb8f011a0
            m_sbox(0, 41) = &h10fa3d98
            m_sbox(1, 41) = &hfd2183b8
            m_sbox(2, 41) = &h4afcb56c
            m_sbox(3, 41) = &h2dd1d35b
            m_sbox(0, 42) = &h9a53e479
            m_sbox(1, 42) = &hb6f84565
            m_sbox(2, 42) = &hd28e49bc
            m_sbox(3, 42) = &h4bfb9790
            m_sbox(0, 43) = &he1ddf2da
            m_sbox(1, 43) = &ha4cb7e33
            m_sbox(2, 43) = &h62fb1341
            m_sbox(3, 43) = &hcee4c6e8
            m_sbox(0, 44) = &hef20cada
            m_sbox(1, 44) = &h36774c01
            m_sbox(2, 44) = &hd07e9efe
            m_sbox(3, 44) = &h2bf11fb4
            m_sbox(0, 45) = &h95dbda4d
            m_sbox(1, 45) = &hae909198
            m_sbox(2, 45) = &heaad8e71
            m_sbox(3, 45) = &h6b93d5a0
            m_sbox(0, 46) = &hd08ed1d0
            m_sbox(1, 46) = &hafc725e0
            m_sbox(2, 46) = &h8e3c5b2f
            m_sbox(3, 46) = &h8e7594b7
            m_sbox(0, 47) = &h8ff6e2fb
            m_sbox(1, 47) = &hf2122b64
            m_sbox(2, 47) = &h8888b812
            m_sbox(3, 47) = &h900df01c
            m_sbox(0, 48) = &h4fad5ea0
            m_sbox(1, 48) = &h688fc31c
            m_sbox(2, 48) = &hd1cff191
            m_sbox(3, 48) = &hb3a8c1ad
            m_sbox(0, 49) = &h2f2f2218
            m_sbox(1, 49) = &hbe0e1777
            m_sbox(2, 49) = &hea752dfe
            m_sbox(3, 49) = &h8b021fa1
            m_sbox(0, 50) = &he5a0cc0f
            m_sbox(1, 50) = &hb56f74e8
            m_sbox(2, 50) = &h18acf3d6
            m_sbox(3, 50) = &hce89e299
            m_sbox(0, 51) = &hb4a84fe0
            m_sbox(1, 51) = &hfd13e0b7
            m_sbox(2, 51) = &h7cc43b81
            m_sbox(3, 51) = &hd2ada8d9
            m_sbox(0, 52) = &h165fa266
            m_sbox(1, 52) = &h80957705
            m_sbox(2, 52) = &h93cc7314
            m_sbox(3, 52) = &h211a1477
            m_sbox(0, 53) = &he6ad2065
            m_sbox(1, 53) = &h77b5fa86
            m_sbox(2, 53) = &hc75442f5
            m_sbox(3, 53) = &hfb9d35cf
            m_sbox(0, 54) = &hebcdaf0c
            m_sbox(1, 54) = &h7b3e89a0
            m_sbox(2, 54) = &hd6411bd3
            m_sbox(3, 54) = &hae1e7e49
            m_sbox(0, 55) = &h250e2d
            m_sbox(1, 55) = &h2071b35e
            m_sbox(2, 55) = &h226800bb
            m_sbox(3, 55) = &h57b8e0af
            m_sbox(0, 56) = &h2464369b
            m_sbox(1, 56) = &hf009b91e
            m_sbox(2, 56) = &h5563911d
            m_sbox(3, 56) = &h59dfa6aa
            m_sbox(0, 57) = &h78c14389
            m_sbox(1, 57) = &hd95a537f
            m_sbox(2, 57) = &h207d5ba2
            m_sbox(3, 57) = &h2e5b9c5
            m_sbox(0, 58) = &h83260376
            m_sbox(1, 58) = &h6295cfa9
            m_sbox(2, 58) = &h11c81968
            m_sbox(3, 58) = &h4e734a41
            m_sbox(0, 59) = &hb3472dca
            m_sbox(1, 59) = &h7b14a94a
            m_sbox(2, 59) = &h1b510052
            m_sbox(3, 59) = &h9a532915
            m_sbox(0, 60) = &hd60f573f
            m_sbox(1, 60) = &hbc9bc6e4
            m_sbox(2, 60) = &h2b60a476
            m_sbox(3, 60) = &h81e67400
            m_sbox(0, 61) = &h8ba6fb5
            m_sbox(1, 61) = &h571be91f
            m_sbox(2, 61) = &hf296ec6b
            m_sbox(3, 61) = &h2a0dd915
            m_sbox(0, 62) = &hb6636521
            m_sbox(1, 62) = &he7b9f9b6
            m_sbox(2, 62) = &hff34052e
            m_sbox(3, 62) = &hc5855664
            m_sbox(0, 63) = &h53b02d5d
            m_sbox(1, 63) = &ha99f8fa1
            m_sbox(2, 63) = &h8ba4799
            m_sbox(3, 63) = &h6e85076a
            m_sbox(0, 64) = &h4b7a70e9
            m_sbox(1, 64) = &hb5b32944
            m_sbox(2, 64) = &hdb75092e
            m_sbox(3, 64) = &hc4192623
            m_sbox(0, 65) = &had6ea6b0
            m_sbox(1, 65) = &h49a7df7d
            m_sbox(2, 65) = &h9cee60b8
            m_sbox(3, 65) = &h8fedb266
            m_sbox(0, 66) = &hecaa8c71
            m_sbox(1, 66) = &h699a17ff
            m_sbox(2, 66) = &h5664526c
            m_sbox(3, 66) = &hc2b19ee1
            m_sbox(0, 67) = &h193602a5
            m_sbox(1, 67) = &h75094c29
            m_sbox(2, 67) = &ha0591340
            m_sbox(3, 67) = &he4183a3e
            m_sbox(0, 68) = &h3f54989a
            m_sbox(1, 68) = &h5b429d65
            m_sbox(2, 68) = &h6b8fe4d6
            m_sbox(3, 68) = &h99f73fd6
            m_sbox(0, 69) = &ha1d29c07
            m_sbox(1, 69) = &hefe830f5
            m_sbox(2, 69) = &h4d2d38e6
            m_sbox(3, 69) = &hf0255dc1
            m_sbox(0, 70) = &h4cdd2086
            m_sbox(1, 70) = &h8470eb26
            m_sbox(2, 70) = &h6382e9c6
            m_sbox(3, 70) = &h21ecc5e
            m_sbox(0, 71) = &h9686b3f
            m_sbox(1, 71) = &h3ebaefc9
            m_sbox(2, 71) = &h3c971814
            m_sbox(3, 71) = &h6b6a70a1
            m_sbox(0, 72) = &h687f3584
            m_sbox(1, 72) = &h52a0e286
            m_sbox(2, 72) = &hb79c5305
            m_sbox(3, 72) = &haa500737
            m_sbox(0, 73) = &h3e07841c
            m_sbox(1, 73) = &h7fdeae5c
            m_sbox(2, 73) = &h8e7d44ec
            m_sbox(3, 73) = &h5716f2b8
            m_sbox(0, 74) = &hb03ada37
            m_sbox(1, 74) = &hf0500c0d
            m_sbox(2, 74) = &hf01c1f04
            m_sbox(3, 74) = &h200b3ff
            m_sbox(0, 75) = &hae0cf51a
            m_sbox(1, 75) = &h3cb574b2
            m_sbox(2, 75) = &h25837a58
            m_sbox(3, 75) = &hdc0921bd
            m_sbox(0, 76) = &hd19113f9
            m_sbox(1, 76) = &h7ca92ff6
            m_sbox(2, 76) = &h94324773
            m_sbox(3, 76) = &h22f54701
            m_sbox(0, 77) = &h3ae5e581
            m_sbox(1, 77) = &h37c2dadc
            m_sbox(2, 77) = &hc8b57634
            m_sbox(3, 77) = &h9af3dda7
            m_sbox(0, 78) = &ha9446146
            m_sbox(1, 78) = &hfd0030e
            m_sbox(2, 78) = &hecc8c73e
            m_sbox(3, 78) = &ha4751e41
            m_sbox(0, 79) = &he238cd99
            m_sbox(1, 79) = &h3bea0e2f
            m_sbox(2, 79) = &h3280bba1
            m_sbox(3, 79) = &h183eb331
            m_sbox(0, 80) = &h4e548b38
            m_sbox(1, 80) = &h4f6db908
            m_sbox(2, 80) = &h6f420d03
            m_sbox(3, 80) = &hf60a04bf
            m_sbox(0, 81) = &h2cb81290
            m_sbox(1, 81) = &h24977c79
            m_sbox(2, 81) = &h5679b072
            m_sbox(3, 81) = &hbcaf89af
            m_sbox(0, 82) = &hde9a771f
            m_sbox(1, 82) = &hd9930810
            m_sbox(2, 82) = &hb38bae12
            m_sbox(3, 82) = &hdccf3f2e
            m_sbox(0, 83) = &h5512721f
            m_sbox(1, 83) = &h2e6b7124
            m_sbox(2, 83) = &h501adde6
            m_sbox(3, 83) = &h9f84cd87
            m_sbox(0, 84) = &h7a584718
            m_sbox(1, 84) = &h7408da17
            m_sbox(2, 84) = &hbc9f9abc
            m_sbox(3, 84) = &he94b7d8c
            m_sbox(0, 85) = &hec7aec3a
            m_sbox(1, 85) = &hdb851dfa
            m_sbox(2, 85) = &h63094366
            m_sbox(3, 85) = &hc464c3d2
            m_sbox(0, 86) = &hef1c1847
            m_sbox(1, 86) = &h3215d908
            m_sbox(2, 86) = &hdd433b37
            m_sbox(3, 86) = &h24c2ba16
            m_sbox(0, 87) = &h12a14d43
            m_sbox(1, 87) = &h2a65c451
            m_sbox(2, 87) = &h50940002
            m_sbox(3, 87) = &h133ae4dd
            m_sbox(0, 88) = &h71dff89e
            m_sbox(1, 88) = &h10314e55
            m_sbox(2, 88) = &h81ac77d6
            m_sbox(3, 88) = &h5f11199b
            m_sbox(0, 89) = &h43556f1
            m_sbox(1, 89) = &hd7a3c76b
            m_sbox(2, 89) = &h3c11183b
            m_sbox(3, 89) = &h5924a509
            m_sbox(0, 90) = &hf28fe6ed
            m_sbox(1, 90) = &h97f1fbfa
            m_sbox(2, 90) = &h9ebabf2c
            m_sbox(3, 90) = &h1e153c6e
            m_sbox(0, 91) = &h86e34570
            m_sbox(1, 91) = &heae96fb1
            m_sbox(2, 91) = &h860e5e0a
            m_sbox(3, 91) = &h5a3e2ab3
            m_sbox(0, 92) = &h771fe71c
            m_sbox(1, 92) = &h4e3d06fa
            m_sbox(2, 92) = &h2965dcb9
            m_sbox(3, 92) = &h99e71d0f
            m_sbox(0, 93) = &h803e89d6
            m_sbox(1, 93) = &h5266c825
            m_sbox(2, 93) = &h2e4cc978
            m_sbox(3, 93) = &h9c10b36a
            m_sbox(0, 94) = &hc6150eba
            m_sbox(1, 94) = &h94e2ea78
            m_sbox(2, 94) = &ha5fc3c53
            m_sbox(3, 94) = &h1e0a2df4
            m_sbox(0, 95) = &hf2f74ea7
            m_sbox(1, 95) = &h361d2b3d
            m_sbox(2, 95) = &h1939260f
            m_sbox(3, 95) = &h19c27960
            m_sbox(0, 96) = &h5223a708
            m_sbox(1, 96) = &hf71312b6
            m_sbox(2, 96) = &hebadfe6e
            m_sbox(3, 96) = &heac31f66
            m_sbox(0, 97) = &he3bc4595
            m_sbox(1, 97) = &ha67bc883
            m_sbox(2, 97) = &hb17f37d1
            m_sbox(3, 97) = &h18cff28
            m_sbox(0, 98) = &hc332ddef
            m_sbox(1, 98) = &hbe6c5aa5
            m_sbox(2, 98) = &h65582185
            m_sbox(3, 98) = &h68ab9802
            m_sbox(0, 99) = &heecea50f
            m_sbox(1, 99) = &hdb2f953b
            m_sbox(2, 99) = &h2aef7dad
            m_sbox(3, 99) = &h5b6e2f84
            m_sbox(0, 100) = &h1521b628
            m_sbox(1, 100) = &h29076170
            m_sbox(2, 100) = &hecdd4775
            m_sbox(3, 100) = &h619f1510
            m_sbox(0, 101) = &h13cca830
            m_sbox(1, 101) = &heb61bd96
            m_sbox(2, 101) = &h334fe1e
            m_sbox(3, 101) = &haa0363cf
            m_sbox(0, 102) = &hb5735c90
            m_sbox(1, 102) = &h4c70a239
            m_sbox(2, 102) = &hd59e9e0b
            m_sbox(3, 102) = &hcbaade14
            m_sbox(0, 103) = &heecc86bc
            m_sbox(1, 103) = &h60622ca7
            m_sbox(2, 103) = &h9cab5cab
            m_sbox(3, 103) = &hb2f3846e
            m_sbox(0, 104) = &h648b1eaf
            m_sbox(1, 104) = &h19bdf0ca
            m_sbox(2, 104) = &ha02369b9
            m_sbox(3, 104) = &h655abb50
            m_sbox(0, 105) = &h40685a32
            m_sbox(1, 105) = &h3c2ab4b3
            m_sbox(2, 105) = &h319ee9d5
            m_sbox(3, 105) = &hc021b8f7
            m_sbox(0, 106) = &h9b540b19
            m_sbox(1, 106) = &h875fa099
            m_sbox(2, 106) = &h95f7997e
            m_sbox(3, 106) = &h623d7da8
            m_sbox(0, 107) = &hf837889a
            m_sbox(1, 107) = &h97e32d77
            m_sbox(2, 107) = &h11ed935f
            m_sbox(3, 107) = &h16681281
            m_sbox(0, 108) = &he358829
            m_sbox(1, 108) = &hc7e61fd6
            m_sbox(2, 108) = &h96dedfa1
            m_sbox(3, 108) = &h7858ba99
            m_sbox(0, 109) = &h57f584a5
            m_sbox(1, 109) = &h1b227263
            m_sbox(2, 109) = &h9b83c3ff
            m_sbox(3, 109) = &h1ac24696
            m_sbox(0, 110) = &hcdb30aeb
            m_sbox(1, 110) = &h532e3054
            m_sbox(2, 110) = &h8fd948e4
            m_sbox(3, 110) = &h6dbc3128
            m_sbox(0, 111) = &h58ebf2ef
            m_sbox(1, 111) = &h34c6ffea
            m_sbox(2, 111) = &hfe28ed61
            m_sbox(3, 111) = &hee7c3c73
            m_sbox(0, 112) = &h5d4a14d9
            m_sbox(1, 112) = &he864b7e3
            m_sbox(2, 112) = &h42105d14
            m_sbox(3, 112) = &h203e13e0
            m_sbox(0, 113) = &h45eee2b6
            m_sbox(1, 113) = &ha3aaabea
            m_sbox(2, 113) = &hdb6c4f15
            m_sbox(3, 113) = &hfacb4fd0
            m_sbox(0, 114) = &hc742f442
            m_sbox(1, 114) = &hef6abbb5
            m_sbox(2, 114) = &h654f3b1d
            m_sbox(3, 114) = &h41cd2105
            m_sbox(0, 115) = &hd81e799e
            m_sbox(1, 115) = &h86854dc7
            m_sbox(2, 115) = &he44b476a
            m_sbox(3, 115) = &h3d816250
            m_sbox(0, 116) = &hcf62a1f2
            m_sbox(1, 116) = &h5b8d2646
            m_sbox(2, 116) = &hfc8883a0
            m_sbox(3, 116) = &hc1c7b6a3
            m_sbox(0, 117) = &h7f1524c3
            m_sbox(1, 117) = &h69cb7492
            m_sbox(2, 117) = &h47848a0b
            m_sbox(3, 117) = &h5692b285
            m_sbox(0, 118) = &h95bbf00
            m_sbox(1, 118) = &had19489d
            m_sbox(2, 118) = &h1462b174
            m_sbox(3, 118) = &h23820e00
            m_sbox(0, 119) = &h58428d2a
            m_sbox(1, 119) = &hc55f5ea
            m_sbox(2, 119) = &h1dadf43e
            m_sbox(3, 119) = &h233f7061
            m_sbox(0, 120) = &h3372f092
            m_sbox(1, 120) = &h8d937e41
            m_sbox(2, 120) = &hd65fecf1
            m_sbox(3, 120) = &h6c223bdb
            m_sbox(0, 121) = &h7cde3759
            m_sbox(1, 121) = &hcbee7460
            m_sbox(2, 121) = &h4085f2a7
            m_sbox(3, 121) = &hce77326e
            m_sbox(0, 122) = &ha6078084
            m_sbox(1, 122) = &h19f8509e
            m_sbox(2, 122) = &he8efd855
            m_sbox(3, 122) = &h61d99735
            m_sbox(0, 123) = &ha969a7aa
            m_sbox(1, 123) = &hc50c06c2
            m_sbox(2, 123) = &h5a04abfc
            m_sbox(3, 123) = &h800bcadc
            m_sbox(0, 124) = &h9e447a2e
            m_sbox(1, 124) = &hc3453484
            m_sbox(2, 124) = &hfdd56705
            m_sbox(3, 124) = &he1e9ec9
            m_sbox(0, 125) = &hdb73dbd3
            m_sbox(1, 125) = &h105588cd
            m_sbox(2, 125) = &h675fda79
            m_sbox(3, 125) = &he3674340
            m_sbox(0, 126) = &hc5c43465
            m_sbox(1, 126) = &h713e38d8
            m_sbox(2, 126) = &h3d28f89e
            m_sbox(3, 126) = &hf16dff20
            m_sbox(0, 127) = &h153e21e7
            m_sbox(1, 127) = &h8fb03d4a
            m_sbox(2, 127) = &he6e39f2b
            m_sbox(3, 127) = &hdb83adf7
            m_sbox(0, 128) = &he93d5a68
            m_sbox(1, 128) = &h948140f7
            m_sbox(2, 128) = &hf64c261c
            m_sbox(3, 128) = &h94692934
            m_sbox(0, 129) = &h411520f7
            m_sbox(1, 129) = &h7602d4f7
            m_sbox(2, 129) = &hbcf46b2e
            m_sbox(3, 129) = &hd4a20068
            m_sbox(0, 130) = &hd4082471
            m_sbox(1, 130) = &h3320f46a
            m_sbox(2, 130) = &h43b7d4b7
            m_sbox(3, 130) = &h500061af
            m_sbox(0, 131) = &h1e39f62e
            m_sbox(1, 131) = &h97244546
            m_sbox(2, 131) = &h14214f74
            m_sbox(3, 131) = &hbf8b8840
            m_sbox(0, 132) = &h4d95fc1d
            m_sbox(1, 132) = &h96b591af
            m_sbox(2, 132) = &h70f4ddd3
            m_sbox(3, 132) = &h66a02f45
            m_sbox(0, 133) = &hbfbc09ec
            m_sbox(1, 133) = &h3bd9785
            m_sbox(2, 133) = &h7fac6dd0
            m_sbox(3, 133) = &h31cb8504
            m_sbox(0, 134) = &h96eb27b3
            m_sbox(1, 134) = &h55fd3941
            m_sbox(2, 134) = &hda2547e6
            m_sbox(3, 134) = &habca0a9a
            m_sbox(0, 135) = &h28507825
            m_sbox(1, 135) = &h530429f4
            m_sbox(2, 135) = &ha2c86da
            m_sbox(3, 135) = &he9b66dfb
            m_sbox(0, 136) = &h68dc1462
            m_sbox(1, 136) = &hd7486900
            m_sbox(2, 136) = &h680ec0a4
            m_sbox(3, 136) = &h27a18dee
            m_sbox(0, 137) = &h4f3ffea2
            m_sbox(1, 137) = &he887ad8c
            m_sbox(2, 137) = &hb58ce006
            m_sbox(3, 137) = &h7af4d6b6
            m_sbox(0, 138) = &haace1e7c
            m_sbox(1, 138) = &hd3375fec
            m_sbox(2, 138) = &hce78a399
            m_sbox(3, 138) = &h406b2a42
            m_sbox(0, 139) = &h20fe9e35
            m_sbox(1, 139) = &hd9f385b9
            m_sbox(2, 139) = &hee39d7ab
            m_sbox(3, 139) = &h3b124e8b
            m_sbox(0, 140) = &h1dc9faf7
            m_sbox(1, 140) = &h4b6d1856
            m_sbox(2, 140) = &h26a36631
            m_sbox(3, 140) = &heae397b2
            m_sbox(0, 141) = &h3a6efa74
            m_sbox(1, 141) = &hdd5b4332
            m_sbox(2, 141) = &h6841e7f7
            m_sbox(3, 141) = &hca7820fb
            m_sbox(0, 142) = &hfb0af54e
            m_sbox(1, 142) = &hd8feb397
            m_sbox(2, 142) = &h454056ac
            m_sbox(3, 142) = &hba489527
            m_sbox(0, 143) = &h55533a3a
            m_sbox(1, 143) = &h20838d87
            m_sbox(2, 143) = &hfe6ba9b7
            m_sbox(3, 143) = &hd096954b
            m_sbox(0, 144) = &h55a867bc
            m_sbox(1, 144) = &ha1159a58
            m_sbox(2, 144) = &hcca92963
            m_sbox(3, 144) = &h99e1db33
            m_sbox(0, 145) = &ha62a4a56
            m_sbox(1, 145) = &h3f3125f9
            m_sbox(2, 145) = &h5ef47e1c
            m_sbox(3, 145) = &h9029317c
            m_sbox(0, 146) = &hfdf8e802
            m_sbox(1, 146) = &h4272f70
            m_sbox(2, 146) = &h80bb155c
            m_sbox(3, 146) = &h5282ce3
            m_sbox(0, 147) = &h95c11548
            m_sbox(1, 147) = &he4c66d22
            m_sbox(2, 147) = &h48c1133f
            m_sbox(3, 147) = &hc70f86dc
            m_sbox(0, 148) = &h7f9c9ee
            m_sbox(1, 148) = &h41041f0f
            m_sbox(2, 148) = &h404779a4
            m_sbox(3, 148) = &h5d886e17
            m_sbox(0, 149) = &h325f51eb
            m_sbox(1, 149) = &hd59bc0d1
            m_sbox(2, 149) = &hf2bcc18f
            m_sbox(3, 149) = &h41113564
            m_sbox(0, 150) = &h257b7834
            m_sbox(1, 150) = &h602a9c60
            m_sbox(2, 150) = &hdff8e8a3
            m_sbox(3, 150) = &h1f636c1b
            m_sbox(0, 151) = &he12b4c2
            m_sbox(1, 151) = &h2e1329e
            m_sbox(2, 151) = &haf664fd1
            m_sbox(3, 151) = &hcad18115
            m_sbox(0, 152) = &h6b2395e0
            m_sbox(1, 152) = &h333e92e1
            m_sbox(2, 152) = &h3b240b62
            m_sbox(3, 152) = &heebeb922
            m_sbox(0, 153) = &h85b2a20e
            m_sbox(1, 153) = &he6ba0d99
            m_sbox(2, 153) = &hde720c8c
            m_sbox(3, 153) = &h2da2f728
            m_sbox(0, 154) = &hd0127845
            m_sbox(1, 154) = &h95b794fd
            m_sbox(2, 154) = &h647d0862
            m_sbox(3, 154) = &he7ccf5f0
            m_sbox(0, 155) = &h5449a36f
            m_sbox(1, 155) = &h877d48fa
            m_sbox(2, 155) = &hc39dfd27
            m_sbox(3, 155) = &hf33e8d1e
            m_sbox(0, 156) = &ha476341
            m_sbox(1, 156) = &h992eff74
            m_sbox(2, 156) = &h3a6f6eab
            m_sbox(3, 156) = &hf4f8fd37
            m_sbox(0, 157) = &ha812dc60
            m_sbox(1, 157) = &ha1ebddf8
            m_sbox(2, 157) = &h991be14c
            m_sbox(3, 157) = &hdb6e6b0d
            m_sbox(0, 158) = &hc67b5510
            m_sbox(1, 158) = &h6d672c37
            m_sbox(2, 158) = &h2765d43b
            m_sbox(3, 158) = &hdcd0e804
            m_sbox(0, 159) = &hf1290dc7
            m_sbox(1, 159) = &hcc00ffa3
            m_sbox(2, 159) = &hb5390f92
            m_sbox(3, 159) = &h690fed0b
            m_sbox(0, 160) = &h667b9ffb
            m_sbox(1, 160) = &hcedb7d9c
            m_sbox(2, 160) = &ha091cf0b
            m_sbox(3, 160) = &hd9155ea3
            m_sbox(0, 161) = &hbb132f88
            m_sbox(1, 161) = &h515bad24
            m_sbox(2, 161) = &h7b9479bf
            m_sbox(3, 161) = &h763bd6eb
            m_sbox(0, 162) = &h37392eb3
            m_sbox(1, 162) = &hcc115979
            m_sbox(2, 162) = &h8026e297
            m_sbox(3, 162) = &hf42e312d
            m_sbox(0, 163) = &h6842ada7
            m_sbox(1, 163) = &hc66a2b3b
            m_sbox(2, 163) = &h12754ccc
            m_sbox(3, 163) = &h782ef11c
            m_sbox(0, 164) = &h6a124237
            m_sbox(1, 164) = &hb79251e7
            m_sbox(2, 164) = &h6a1bbe6
            m_sbox(3, 164) = &h4bfb6350
            m_sbox(0, 165) = &h1a6b1018
            m_sbox(1, 165) = &h11caedfa
            m_sbox(2, 165) = &h3d25bdd8
            m_sbox(3, 165) = &he2e1c3c9
            m_sbox(0, 166) = &h44421659
            m_sbox(1, 166) = &ha121386
            m_sbox(2, 166) = &hd90cec6e
            m_sbox(3, 166) = &hd5abea2a
            m_sbox(0, 167) = &h64af674e
            m_sbox(1, 167) = &hda86a85f
            m_sbox(2, 167) = &hbebfe988
            m_sbox(3, 167) = &h64e4c3fe
            m_sbox(0, 168) = &h9dbc8057
            m_sbox(1, 168) = &hf0f7c086
            m_sbox(2, 168) = &h60787bf8
            m_sbox(3, 168) = &h6003604d
            m_sbox(0, 169) = &hd1fd8346
            m_sbox(1, 169) = &hf6381fb0
            m_sbox(2, 169) = &h7745ae04
            m_sbox(3, 169) = &hd736fccc
            m_sbox(0, 170) = &h83426b33
            m_sbox(1, 170) = &hf01eab71
            m_sbox(2, 170) = &hb0804187
            m_sbox(3, 170) = &h3c005e5f
            m_sbox(0, 171) = &h77a057be
            m_sbox(1, 171) = &hbde8ae24
            m_sbox(2, 171) = &h55464299
            m_sbox(3, 171) = &hbf582e61
            m_sbox(0, 172) = &h4e58f48f
            m_sbox(1, 172) = &hf2ddfda2
            m_sbox(2, 172) = &hf474ef38
            m_sbox(3, 172) = &h8789bdc2
            m_sbox(0, 173) = &h5366f9c3
            m_sbox(1, 173) = &hc8b38e74
            m_sbox(2, 173) = &hb475f255
            m_sbox(3, 173) = &h46fcd9b9
            m_sbox(0, 174) = &h7aeb2661
            m_sbox(1, 174) = &h8b1ddf84
            m_sbox(2, 174) = &h846a0e79
            m_sbox(3, 174) = &h915f95e2
            m_sbox(0, 175) = &h466e598e
            m_sbox(1, 175) = &h20b45770
            m_sbox(2, 175) = &h8cd55591
            m_sbox(3, 175) = &hc902de4c
            m_sbox(0, 176) = &hb90bace1
            m_sbox(1, 176) = &hbb8205d0
            m_sbox(2, 176) = &h11a86248
            m_sbox(3, 176) = &h7574a99e
            m_sbox(0, 177) = &hb77f19b6
            m_sbox(1, 177) = &he0a9dc09
            m_sbox(2, 177) = &h662d09a1
            m_sbox(3, 177) = &hc4324633
            m_sbox(0, 178) = &he85a1f02
            m_sbox(1, 178) = &h9f0be8c
            m_sbox(2, 178) = &h4a99a025
            m_sbox(3, 178) = &h1d6efe10
            m_sbox(0, 179) = &h1ab93d1d
            m_sbox(1, 179) = &hba5a4df
            m_sbox(2, 179) = &ha186f20f
            m_sbox(3, 179) = &h2868f169
            m_sbox(0, 180) = &hdcb7da83
            m_sbox(1, 180) = &h573906fe
            m_sbox(2, 180) = &ha1e2ce9b
            m_sbox(3, 180) = &h4fcd7f52
            m_sbox(0, 181) = &h50115e01
            m_sbox(1, 181) = &ha70683fa
            m_sbox(2, 181) = &ha002b5c4
            m_sbox(3, 181) = &hde6d027
            m_sbox(0, 182) = &h9af88c27
            m_sbox(1, 182) = &h773f8641
            m_sbox(2, 182) = &hc3604c06
            m_sbox(3, 182) = &h61a806b5
            m_sbox(0, 183)
            -=Alex=-

            Comment

            Working...
            X