Code: Select all
Procedure XOrCrypt(*Buffer,Len.l, KeyS.i, KeyE.i)
;just some weird xor encryption algorithm by JLC
Protected i, Byte.b, KeyByte.b
Protected KeyLength = KeyE - KeyS, KeyPos
For i=0 To Len-1
Byte = PeekB(*Buffer+i)
KeyByte = PeekB(KeyS+KeyPos)
;PeekB(*Buffer+i) ! PeekB(@Key$+KeyPos) ! Len ! i
Byte ! KeyByte ! Len ! i ! KeyLength ;xor the shit
PokeB(*Buffer+i,Byte)
KeyPos + 1
If KeyPos > KeyLength
KeyPos = 0
EndIf
Next
EndProcedure
String$ = "maria"
Length = StringByteLength(String$,#PB_Unicode)
XOrCrypt(@String$,Length,?KeyStart,?KeyEnd) ;encrypt
Length * 2
str$ = Base64Encoder(@String$,Length)
Debug str$
str$ = "91HZhhCLHk9CPAAArgMgAMMDxwM="
Length = StringByteLength(str$,#PB_Unicode)
String2$ = Space(Length)
i = Base64Decoder(str$, @String2$,Length)
i = StringByteLength(String2$,#PB_Unicode)
XOrCrypt(@String2$,i,?KeyStart,?KeyEnd) ;decrypt
Debug String2$
Debug ?KeyEnd - ?KeyStart
DataSection
KeyStart:
Data.a $D0, $1A, $F0, $CF, $2C, $C4, $3B, $02, $61, $7F, $9F, $3D, $DB, $6C, $13, $61
Data.a $53, $15, $6D, $31, $BE, $7C, $42, $8C, $1F, $58, $F7, $A3, $F6, $E3, $3E, $03
Data.a $5F, $6D, $7B, $56, $CF, $27, $68, $AA, $7C, $0E, $47, $55, $DF, $45, $77, $6E
Data.a $6E, $9A, $B8, $71, $50, $28, $01, $85, $3C, $F0, $12, $48, $82, $ED, $19, $27
KeyEnd:
EndDataSection