Post by xcoder on Jun 7, 2023 18:54:33 GMT
Print "##############################################"
'''''' www.rfc-editor.org/rfc/rfc6229
in$ = ""
code$ = "0102030405" 'hexidecimal key 40 bits
for i = 1 to len(code$)step 2
chunk$ = mid$(code$,i,2)
print chunk$,
byte = hexDec(chunk$) 'hex to ascii
print byte
key$ = key$ + chr$(byte) 'ascii to characters
next i
print:print
print key$
call KSA key$
print PRGA$(in$)
print:print
print "Finished"
End
sub KSA key$ 'key expansion
dim S(256)
dim K(256)
i = 0: j = 0
for i = 0 to 255
S(i)= i
next i
for i = 0 to 255
K(i) = asc(mid$(key$,i mod len(key$)+1))
next i
for i = 0 to 255
j = (j+ S(i)+ K(i))mod 256
temp = S(i)
S(i)= S(j)
S(j)= temp
next i
end sub
'-------------------------------------------------
function PRGA$(in$) 'pseudo random byte generator
i = 0 :j = 0: x = 0
while in$ = ""
i = (i + 1) mod 256 '**********
j = (j + S(i))mod 256
temp = S(i)
S(i) = S(j)
S(j) = temp
t = (S(i) + S(j))mod 256 ''''changed Real RC4
k = S(t) ''''changed Real RC4
ck = byte xor k ''' changed Real RC4
char$ = char$ + chr$(ck) '''changed Real RC4
x = x + 1
if x = 272 then exit while ''' 'increment in units of 16
wend
PRGA$ = text2Hex$(char$)
end function
function text2Hex$(txt$)
for i = 1 to len(txt$)
hex$ = dechex$(asc(mid$(txt$,i,1)))
fullHex$ = fullHex$ + right$("0" + hex$, 2)+ space$(2)
next i
ctr = 0
for j = 1 to len(fullHex$) step 64 '16 * 32 *32
chunk$ = mid$(fullHex$,j,64)
print ctr, chunk$
ctr = ctr + 16
next j
end function
'''''' www.rfc-editor.org/rfc/rfc6229
'''''' www.rfc-editor.org/rfc/rfc6229
in$ = ""
code$ = "0102030405" 'hexidecimal key 40 bits
for i = 1 to len(code$)step 2
chunk$ = mid$(code$,i,2)
print chunk$,
byte = hexDec(chunk$) 'hex to ascii
print byte
key$ = key$ + chr$(byte) 'ascii to characters
next i
print:print
print key$
call KSA key$
print PRGA$(in$)
print:print
print "Finished"
End
sub KSA key$ 'key expansion
dim S(256)
dim K(256)
i = 0: j = 0
for i = 0 to 255
S(i)= i
next i
for i = 0 to 255
K(i) = asc(mid$(key$,i mod len(key$)+1))
next i
for i = 0 to 255
j = (j+ S(i)+ K(i))mod 256
temp = S(i)
S(i)= S(j)
S(j)= temp
next i
end sub
'-------------------------------------------------
function PRGA$(in$) 'pseudo random byte generator
i = 0 :j = 0: x = 0
while in$ = ""
i = (i + 1) mod 256 '**********
j = (j + S(i))mod 256
temp = S(i)
S(i) = S(j)
S(j) = temp
t = (S(i) + S(j))mod 256 ''''changed Real RC4
k = S(t) ''''changed Real RC4
ck = byte xor k ''' changed Real RC4
char$ = char$ + chr$(ck) '''changed Real RC4
x = x + 1
if x = 272 then exit while ''' 'increment in units of 16
wend
PRGA$ = text2Hex$(char$)
end function
function text2Hex$(txt$)
for i = 1 to len(txt$)
hex$ = dechex$(asc(mid$(txt$,i,1)))
fullHex$ = fullHex$ + right$("0" + hex$, 2)+ space$(2)
next i
ctr = 0
for j = 1 to len(fullHex$) step 64 '16 * 32 *32
chunk$ = mid$(fullHex$,j,64)
print ctr, chunk$
ctr = ctr + 16
next j
end function
'''''' www.rfc-editor.org/rfc/rfc6229