Check-in [32a0f84a02]
Overview
Comment:Better formatting of checksums and publickeys
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 32a0f84a022971891f1dfb76dc9f0e4b6be8316ed939a1bf346cc6e4276152af
User & Date: rkeene on 2019-01-22 18:27:13
Other Links: manifest | tags
Context
2019-01-22
18:32
Clean up amalgamation coverage bits check-in: 224abfa34b user: rkeene tags: trunk
18:27
Better formatting of checksums and publickeys check-in: 32a0f84a02 user: rkeene tags: trunk
18:26
Better formatting of data from wallets check-in: c77f5a51cd user: rkeene tags: trunk
Changes

Modified nano.tcl from [40a809aa05] to [648175fcaf].

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