Bitcoin/address validation: Difference between revisions
Content added Content deleted
('Off by one' error, but this is a critical fix. The entire range of items in output array must be evaluated. This change is necessary so that pay to script hash (P2SH) addresses that start with 3 can be validated as well.) |
|||
Line 602: | Line 602: | ||
let address = toBytes ev |
let address = toBytes ev |
||
addressLength = length address |
addressLength = length address |
||
in if addressLength > |
in if addressLength > 25 |
||
then Left "Address length exceeds 25 bytes" |
then Left "Address length exceeds 25 bytes" |
||
else |
else |
||
Line 639: | Line 639: | ||
"1ANa55215ZQXAZUgFiqJ2i7Z2DPU2J6hW62i" -> "Address length exceeds 25 bytes" |
"1ANa55215ZQXAZUgFiqJ2i7Z2DPU2J6hW62i" -> "Address length exceeds 25 bytes" |
||
"i55j" -> "Address length less than 4 bytes"</pre> |
"i55j" -> "Address length less than 4 bytes"</pre> |
||
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
=={{header|Mathematica}} / {{header|Wolfram Language}}== |
||
<lang Mathematica>chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; data = |
<lang Mathematica>chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; data = |