Discussioni categoria:Algoritmi
Vai alla navigazione
Vai alla ricerca
Era presente questo testo:
Questa è la sottrazione in base 256 che si può applicare ad un testo qualsiasi o anche a qualsiasi file ascii.
dim inarray(1000000) dim t as ubyte dim b as ubyte dim c as ubyte dim d as uinteger dim x as ubyte dim e as ubyte 'inversione della stringa originaleadd1 i=0 open "originaleadd1.dat" for binary as #1 do until eof(1)
get #1, ,t
inarray(i) = t i = i+1 loop close #1
open "addendo1.dat" for binary as #2
for k = i-1 to 0 step -1 t=inarray(k) put #2, ,t next k close #2
'inversione della stringa originaleadd2 i=0 open "originaleadd2.dat" for binary as #1 do until eof(1)
get #1, ,t
inarray(i) = t i = i+1 loop close #1
open "addendo2.dat" for binary as #2
for k = i-1 to 0 step -1 t=inarray(k) put #2, ,t next k close #2
'****************somma********************************** open "addendo1.dat" for binary as #1 open "addendo2.dat" for binary as #2 open "som.dat" for binary as #3 do until eof(1) get #1, ,b get #2, ,c
d=b+c+x if (d<256) then x=0 if (d>255) then d=d-256:x=1
for m = 0 to 255: if (d = m) then put #3, , chr$(m) next m
loop close #1 close #2 close #3 '*********************fine somma************************
'inversione della stringa somma i=0 open "som.dat" for binary as #1 do until eof(1)
get #1, ,t
inarray(i) = t i = i+1 loop close #1
open "somma.dat" for binary as #2
for k = i-1 to 0 step -1 t=inarray(k) put #2, ,t next k close #2 '====================================================
e questa è la somma in base 256 che permette di sommare un testo o un file ascii ad un altro. Questo è stato ottenuto grazie a FREEBASIC un compilatore libero straordinario