Base change

calccrypto 28 Jan 2009 01:59

Are these two the exact opposite of each other?

```
16 chars in Str1 and Str2
"0123456789abcdef→Str0
Hex to binary
----
For(X,1,16,2
(inString(Str0,sub(Str1,X,1))-1)16+inString(Str0,sub(Str1,X+1,1))-1→A
For(Y,7,0,-1
If A≥2^Y
Then
Str3+"1→Str3
A-2^Y→A
Else
Str3+"0→Str3
End
End
End
----
Binary to hex
----
For(X,1,8
0→A
For(Y,7,0,-1
If sub(sub(Str1,8X-7,8),8-Y,1)="1"
A+2^Y→A
End
1+fPart(A/16)16→B
1+int(A/16)→A
Str3+sub(Str0,A,1)+sub(Str0,B,1→Str3
End
----
```

Visit Calccrypto for info on crypto

KC2ZOF