bitcoin-address
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -46,2 +46,8 @@ | ||
// strings starting with only ones need to be adjusted | ||
// e.g. '1' should map to '00' and not '0000' | ||
if (leading_zero && !seen_other) { | ||
--leading_zero; | ||
} | ||
while (leading_zero-- > 0) { | ||
@@ -48,0 +54,0 @@ hex = '00' + hex; |
@@ -20,4 +20,5 @@ | ||
function get_address_type(address) { | ||
var decoded_hex; | ||
try { | ||
var decoded_hex = base58.decode(address); | ||
decoded_hex = base58.decode(address); | ||
} catch (e) { | ||
@@ -40,3 +41,3 @@ // if decoding fails, assume invalid address | ||
var good_cksum = sha256_digest(sha256_digest(body)).substr(0,4); | ||
var good_cksum = sha256_digest(sha256_digest(body)).toString('binary').substr(0,4); | ||
return (cksum === good_cksum ? decoded_hex.slice(0, 2) : null); | ||
@@ -74,3 +75,3 @@ } | ||
function sha256_digest(payload) { | ||
return crypto.createHash('sha256').update(payload).digest('binary'); | ||
return crypto.createHash('sha256').update(payload).digest(); | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "bitcoin address verification and other related functions", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/defunctzombie/bitcoin-address", | ||
@@ -8,0 +8,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7304
11
149