coinstring
Advanced tools
Comparing version 1.0.1 to 2.0.0
@@ -0,1 +1,9 @@ | ||
2.0.0 / 2014-06-25 | ||
------------------ | ||
* changed `encode(payload, version)` to `encode(payload, [version])` | ||
* changed how `decode` works (**broke compatibility** hence major version bump) | ||
old version returned `{payload: ..., version: ...}`, this version now returns | ||
just `payload`, if `version` is passed into `decode`, it's trimmed off of `payload` | ||
1.0.1 / 2014-06-06 | ||
@@ -2,0 +10,0 @@ ------------------ |
@@ -9,10 +9,13 @@ var crypto = require('crypto') | ||
assert(version != null, 'must pass version') | ||
var buf | ||
if (version != null) { | ||
if (typeof version == 'number') | ||
version = new Buffer([version]) | ||
buf = Buffer.concat([version, payload]) | ||
} else { | ||
buf = payload | ||
} | ||
if (typeof version == 'number') | ||
version = new Buffer([version]) | ||
var buf = Buffer.concat([version, payload]) | ||
var checksum = sha256x2(buf).slice(0, 4) | ||
var result = Buffer.concat([version, payload, checksum]) | ||
var result = Buffer.concat([buf, checksum]) | ||
return base58.encode(result) | ||
@@ -26,3 +29,3 @@ } | ||
if (version == null) | ||
versionLength = 1 | ||
versionLength = 0 | ||
else { | ||
@@ -46,3 +49,3 @@ if (typeof version == 'number') | ||
return {version: bytes.slice(0, versionLength), payload: bytes.slice(versionLength)} | ||
return bytes.slice(versionLength) | ||
} | ||
@@ -91,2 +94,1 @@ | ||
} | ||
{ | ||
"name": "coinstring", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Create and parse crypto currency addresses and wallet import formats.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
6810
74