Code:
option explicit
#include "crt.bi"
const as integer sz = 161 * 11 * 4
'sub dio_DeCrypt( srcImg as any ptr, dstPtr as any ptr, seed as integer )
#macro dio_DeCrypt( srcImg, dstPtr, seed )
' if srcImg = 0 then exit sub
' static as integer imgWidth, imgHeight, i, x, y, pa, pb, rx, ry, xo, yo
' static as integer ptr pix, imgData2
' imgWidth = cptr( ushort ptr, srcImg )[0] shr 3
' imgHeight = cptr( ushort ptr, srcImg )[1]
memcpy( dstPtr + 4, srcImg + 4, ( sz ) )
' memcpy( dstPtr + 4, srcImg + 4, ( imgWidth * imgHeight ) * len( integer ) )
imgData2 = cptr( any ptr, VarPtr( cptr( ushort ptr, dstPtr )[2] ) )
randomize seed
' dim as integer pic( sz * 8 )
i = 0
for y = 0 to 11 - 1
for x = 0 to 161 - 1
pic( i ) = int( rnd * ( 161 - 1 ) )
i = i + 1
pic( i ) = int( rnd * ( 11 - 1 ) )
i = i + 1
next
next
pix = varptr( imgData2[(11 * 161) - 1] )
for y = 11 - 1 to 0 step -1
' yo = (y * imgWidth)
for x = 161 - 1 to 0 step -1
i = i - 1
ry = pic(i)
i = i - 1
rx = pic(i)
xo = (ry * 161)+ rx
' pa = imgData2[yo + x]
pa = *pix
pb = imgData2[xo]
imgData2[xo] = pa
*pix = pb
' imgData2[yo + x] = pb
pix -= 1
next
next
#endmacro
'end sub
#macro check_topline( __COLOR__ )
if j then
for l = 0 to 160
if lc[l] <> __COLOR__ then
j = 0
exit for
end if
next
end if
#endmacro
#macro check_rightline( __COLOR__ )
if j then
for l = 0 to 10
if lc[m + 160] <> __COLOR__ then
j = 0
exit for
end if
m += 161
next
end if
#endmacro
#macro check_bottomline( __COLOR__ )
if j then
for l = 0 to 160
if lc[l + 1600] <> __COLOR__ then
j = 0
exit for
end if
next
end if
#endmacro
#macro check_leftline( __COLOR__ )
if j then
for l = 0 to 10
if lc[m] <> __COLOR__ then
j = 0
exit for
end if
m += 161
next
end if
#endmacro
#macro check_alllines( __COLOR__ )
check_topline( __COLOR__ )
check_rightline( __COLOR__ )
check_bottomline( __COLOR__ )
check_leftline( __COLOR__ )
#endmacro
screen 14, 32
dim as any ptr img1, img2
dim as integer ptr lc
img1 = imagecreate( 161, 11 )
img2 = imagecreate( 161, 11 )
bload "10dollarch.bmp", img1
'bload "newimg.bmp", img1
lc = cptr( any ptr, varptr( cptr( ushort ptr, img2 )[2] ) )
dim as uinteger iii, j, k, l, m, ddd
dim as integer imgWidth, imgHeight, i, x, y, pa, pb, rx, ry, xo, yo
dim as integer ptr pix, imgData2
dim as integer pic( sz * 8 )
if command( 1 ) <> "" then
ddd = val( command( 1 ) )
end if
'for iii = ( 2 ^ 32 ) - 1 to 0 step -1
'for iii = 170000 to ( 2 ^ 32 ) - 1
for iii = ddd to ( 2 ^ 32 ) - 1
dio_DeCrypt( img1, img2, iii )
j = -1
k = lc[0]
m = 0
' check_alllines( rgb( 255, 255, 255 ) )
check_topline( k )
k = lc[160]
m = 0
check_rightline( k )
k = lc[1600]
m = 0
check_bottomline( k )
k = lc[0]
m = 0
check_leftline( k )
' rgb( 255, 255, 255 )
' for l = 0 to 10
' if lc[m] <> rgb( 255, 255, 255 ) then
' j = 0
'
' exit for
' end if
' m += 161
' next
skip:
if j = -1 then
? "heh: " & iii
bsave "dioresult.bmp", img2
sleep
end if
if multikey( &h2F ) then
put( 0, 0 ), img2, pset
locate 20
? iii
end if
if multikey( 1 ) then
end
end if
next
verdict: after about 100 million iterations between a few computers, i think it probrbaly isn't brute force crackable =|