You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use your library in my harbour program to transform big number like this :
0x00119B098E2E980A229E139A9ED01A469E518E6F2690AFE11C
in base 58 like this :
12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
I not understand how to implement your class in my program.
How can use your library to reduce my program ?
How can compile with harbour to add your class? (i use harbour core V3 in Windows environnement https://github.com/harbour/core)
function To_base58(Chaine2)
LOCAL i,j, ALPHABET
Local chaine2, Chaine4
Local sZero, binsz, nsize, buf, buf58, high,Carry, zcount
//Transform Ascii to hex
Chaine4=""
for i=1 to len(chaine2)/2
chaine4+=chr(HB_HexToNum(substr(chaine2,(i-1)*2+1,2)))
next
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
// Count leading zeros.
zcount=1
DO WHILE zcount < len(Chaine4) .and. substr(Chaine4,zcount,1) = Chr(0)
zcount++
ENDDO
binsz = len(chaine4)
nsize = int((binsz-zcount)*138/100 + 3)
buf = replicate(chr(0),nsize)
high = nsize
FOR i = zcount TO binsz
j = nsize
Carry = Asc(substr(Chaine4,i,1))
Do while j>0
Carry = Carry + 256*Asc(substr(buf,j,1))
buf = stuff(buf,j,1,chr(mod(Carry,58)))
Carry = int(Carry / 58)
j--
if Carry = 0 .and. j<high
exit
endif
Enddo
high = j
NEXT
buf58=""
zcount--
if zcount>0
for i=1 to zcount
buf58+="1"
next
endif
zcount=1
Do while Asc(substr(buf,zcount,1))=0
zcount++
Enddo
for j=zcount to nsize
buf58+=substr(ALPHABET,Asc(substr(buf,j,1))+1,1)
next
return buf58
The text was updated successfully, but these errors were encountered:
Hello,
I want to use your library in my harbour program to transform big number like this :
0x00119B098E2E980A229E139A9ED01A469E518E6F2690AFE11C
in base 58 like this :
12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
But actually i must use a very long program (see under) to convert big number to base 58.
But with your Tbignumber class, i will reduce my program.
Like : BigNumber%58 (very simple)
example : https://stackoverflow.com/questions/8970715/how-do-i-base58-encode-a-string
I not understand how to implement your class in my program.
How can use your library to reduce my program ?
How can compile with harbour to add your class? (i use harbour core V3 in Windows environnement https://github.com/harbour/core)
Thank you in advance.
?To_base58("00119B098E2E980A229E139A9ED01A469E518E6F2690AFE11C")
The text was updated successfully, but these errors were encountered: