Skip to content

Commit

Permalink
fix: convert checksum to buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Jul 11, 2022
1 parent bc6c1a2 commit 963b028
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/encryption/src/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function base58CheckDecode(btcAddress: string): {
* @ignore
*/
export function base58Encode(hash: Buffer) {
const checksum = sha256(sha256(hash));
const checksum = Buffer.from(sha256(sha256(hash)));
return base58.encode(Buffer.concat([hash, checksum], hash.length + 4));
}

Expand Down
6 changes: 3 additions & 3 deletions packages/encryption/tests/keys.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { address, ECPair, networks } from 'bitcoinjs-lib';
import bs58check from 'bs58check';
import { SECP256K1Client } from 'jsontokens';
import {
base58Encode,
compressPrivateKey,
ecSign,
getPublicKeyFromPrivate,
hashSha256Sync,
makeECPrivateKey,
publicKeyToAddress,
ecSign,
base58Encode,
compressPrivateKey,
} from '../src';
import { hashRipemd160 } from '../src/hashRipemd160';

Expand Down

1 comment on commit 963b028

@vercel
Copy link

@vercel vercel bot commented on 963b028 Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.