168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
set checksum [expr {$result & 0xffffffffff}]
set result [expr {$result >> 40}]
set result [format %064llX $result]
if {$performChecksumCheck} {
set resultBinary [binary decode hex $result]
set checksumVerify [binary encode hex [string reverse [::nano::internal::hashData $resultBinary 5]]]
set checksumVerify [expr "0x$checksumVerify"]
if {$checksum != $checksumVerify} {
return -code error "Invalid address (checksum)"
}
}
if {$outputFormat eq "bytes"} {
|
|
|
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
set checksum [expr {$result & 0xffffffffff}]
set result [expr {$result >> 40}]
set result [format %064llX $result]
if {$performChecksumCheck} {
set resultBinary [binary decode hex $result]
set checksumVerify [binary encode hex [string reverse [::nano::internal::hashData $resultBinary 5]]]
set checksumVerify [format %lli "0x$checksumVerify"]
if {$checksum != $checksumVerify} {
return -code error "Invalid address (checksum)"
}
}
if {$outputFormat eq "bytes"} {
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
}
}
set checksum [string reverse [::nano::internal::hashData $publicKey 5]]
append publicKey $checksum
set publicKey [binary encode hex $publicKey]
set publicKey [expr "0x$publicKey"]
set alphabet [split $::nano::address::base32alphabet ""]
set address ""
for {set index 0} {$index < 60} {incr index} {
set fiveBits [expr {$publicKey & 0x1F}]
set publicKey [expr {$publicKey >> 5}]
set byte [lindex $alphabet $fiveBits]
append address $byte
|
|
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
}
}
set checksum [string reverse [::nano::internal::hashData $publicKey 5]]
append publicKey $checksum
set publicKey [binary encode hex $publicKey]
set publicKey [format %lli "0x$publicKey"]
set alphabet [split $::nano::address::base32alphabet ""]
set address ""
for {set index 0} {$index < 60} {incr index} {
set fiveBits [expr {$publicKey & 0x1F}]
set publicKey [expr {$publicKey >> 5}]
set byte [lindex $alphabet $fiveBits]
append address $byte
|