I started to play, to search for a seed
this code finds one - and then quits
I haven’t tested it against other inputs
I suggest altering the code to search all seeds
and show all seeds that return the desired answer
PROGRAM
MAP
MODULE('RTL')
CRC32( LONG, UNSIGNED, ULONG), ULONG,RAW,NAME('Cla$crc32')
END
END
bb CSTRING(100)
Seed ULONG
AddrBB LONG,AUTO
LenBB UNSIGNED,AUTO
CorrectAnswer EQUATE(3675725989)
Window WINDOW('Caption'),AT(,,395,224),GRAY,AUTO,FONT('Segoe UI',9)
BUTTON('&OK'),AT(291,201,41,14),USE(?OkButton),DEFAULT
BUTTON('&Cancel'),AT(340,201,42,14),USE(?CancelButton),STD(STD:Close)
STRING(@N20),AT(23,27,266),USE(Seed),FONT(,24)
END
EVENT:User:CheckMore EQUATE(EVENT:user)
CODE
bb = 'ABCD'
AddrBB = ADDRESS(BB)
LenBB = LEN(BB)
MESSAGE('ABCD 0 [' & CRC32( AddrBB, LENBB , 0 ) & ']' |
& '|Len+1['& CRC32( AddrBB, LENBB + 1, 0 ) & ']' |
)
OPEN(Window)
POST(EVENT:User:CheckMore)
ACCEPT
CASE EVENT()
OF EVENT:User:checkMore ; DO CheckSeeds
DISPLAY(?Seed)
END
END
CheckSeeds ROUTINE
DATA
rou:Seed ULONG,AUTO
rou:MatchFound BOOL(FALSE)
CODE
LOOP rou:seed = Seed to Seed + 1000
IF CRC32( ADDRBB, LENBB, rou:Seed ) = CorrectAnswer
MESSAGE('Seed['& rou:Seed &']')
rou:MatchFound = TRUE
BREAK
END
IF CRC32( ADDRBB, LENBB + 1, rou:Seed ) = CorrectAnswer
MESSAGE('Seed['& rou:Seed &'] with Len+1')
rou:MatchFound = TRUE
BREAK
END
IF rou:Seed < seed
MESSAGE('Seed overflow')
BREAK
END
END
IF ~rou:MatchFound
Seed += 1000
POST(EVENT:User:CheckMore)
END
! match 130,156,088 with Len+1