Skip to content

Commit 9a3d51f

Browse files
committed
Compatibility improvements.
* Added compatibility with Ian Coleman's BIP39 tool for several input formats: * `base6`, `base10`, `bits`, and `dice` are now compatible. * `hex` as an input method is already compatible if used with his tool in "raw entropy" mode. * `cards` is not compatible as his algorithm is complex and possibly not worth spending the time on. * Updated MANUAL.md examples to remain accurate. * Added a section on Compatibility with other tools to MANUAL.md.
1 parent b61d34f commit 9a3d51f

File tree

14 files changed

+138
-51
lines changed

14 files changed

+138
-51
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "lldb",
88
"request": "launch",
99
"program": "${workspaceFolder}/src/seedtool",
10-
"args": ["--in", "hex", "--out", "bip39", "38a8aaa2d6caff920c67"],
10+
"args": [],
1111
"cwd": "${workspaceFolder}/src",
1212
"preLaunchTask": "Build"
1313
}

MANUAL.md

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🌱 Seedtool
22

3-
**Version 1.0.0b1**<br/>**April 8, 2020**
3+
**Version 0.1.1**<br/>**April 8, 2020**
44

55
*Copyright © 2020 by Blockchain Commons, LLC*<br/>*Licensed under the "BSD-2-Clause Plus Patent License"*
66

@@ -230,7 +230,7 @@ $ seedtool --out bits
230230
#
231231
232232
$ seedtool --in bits 1110110001110111
233-
ed8f723f8216781a047886244f6f75c0
233+
8d933e43b1bc8f2e3fc27adc98ad4534
234234
235235
#
236236
# Construct the same seed from those bits, providing them via stdin.
@@ -239,7 +239,7 @@ ed8f723f8216781a047886244f6f75c0
239239
$ seedtool --in bits
240240
1110110001110111
241241
^D
242-
ed8f723f8216781a047886244f6f75c0
242+
8d933e43b1bc8f2e3fc27adc98ad4534
243243
```
244244

245245
```
@@ -257,14 +257,14 @@ $ seedtool --out cards
257257
#
258258
259259
$ seedtool --in cards 6c9s8c7c9c4cah6c2sjs7d5c2s4c4dqs
260-
2bcd58e32a6fa0f55b6a2e24d77e706f
260+
7df301924511326d7350be14c9e7176d
261261
262262
#
263263
# Construct a longer 32-byte seed from those same playing cards.
264264
#
265265
266266
$ seedtool --count 32 --in cards 6c9s8c7c9c4cah6c2sjs7d5c2s4c4dqs
267-
2bcd58e32a6fa0f55b6a2e24d77e706fdd165482b36dcab10d271a262097bca4
267+
7df301924511326d7350be14c9e7176d98e945f9ad0ed034726ad4ee0de59c25
268268
```
269269

270270
```
@@ -274,21 +274,21 @@ $ seedtool --count 32 --in cards 6c9s8c7c9c4cah6c2sjs7d5c2s4c4dqs
274274
#
275275
276276
$ seedtool --in dice 3343462611234633
277-
d28e978aba2967adb66d4fec42ea6086
277+
77ae0de807d60367311eb040c70690d2
278278
279279
#
280280
# Construct a 16-byte seed from any number of digits in [0-5].
281281
#
282282
283283
$ seedtool --in base6 3242235101442242
284-
e57ff8f262fbeb623a2a86baa52935f0
284+
51621269b3a91fe6482ceb7779f0d1d1
285285
286286
#
287287
# Construct a 16-byte seed from any number of digits in [0-9].
288288
#
289289
290290
$ seedtool --in base10 3190125
291-
61cfda662ecb32294f508fdac513ed9d
291+
a0ca21e20db54b4df7479737c145f6db
292292
293293
#
294294
# Construct a 16-byte seed from any number of integers in [0-255].
@@ -305,17 +305,17 @@ Output of one call to seedtool can be piped into another.
305305
#
306306
307307
$ seedtool --out dice | seedtool --in dice --count 32
308-
838e8c1f73d06282d852733e564430afd0ce2162a734c506167e4cce0d54a3f6
308+
7bdf68608e30da4b9ec48af0cb48f2601b41d1bcc8859b4f625d6c0470f3a6dd
309309
310310
#
311311
# Roll 16 dice saving them to a file, and create a 16-byte seed
312312
# from them.
313313
#
314314
315315
$ seedtool --out dice | tee dice.asc | seedtool --in dice
316-
b67a2f937179e532821cfd9836aa56d4
316+
c13be193c8e3451a20b75e8dc0f69284
317317
$ cat dice.asc
318-
4265544111216531
318+
4435442555226432
319319
```
320320

321321
If a smaller or larger seed is desired, the `--count` option specifies how many bytes it contains.
@@ -326,21 +326,21 @@ If a smaller or larger seed is desired, the `--count` option specifies how many
326326
#
327327
328328
$ seedtool --in bits --count 8 0111100011000011
329-
1e4914918ce8f4dc
329+
1a4783f9e4e8eb68
330330
331331
#
332332
# Create a 32-byte seed from any number of bits.
333333
#
334334
335335
$ seedtool --in bits --count 32 0111100011000011
336-
1e4914918ce8f4dc08755e0b4f97fb6d4715ce9692a91ef600526543543f1af1
336+
1a4783f9e4e8eb6862cbd34acfe4f79ee8ee4e0e6f5726e589a36c7e8bf8a547
337337
338338
#
339339
# Create a 20-byte seed from any number of playing cards.
340340
#
341341
342342
$ seedtool --in cards --count 20 6c2c3hthacts6d4hkhtd2d7c6c3sqs6h
343-
f44c7708363d99857e60cb313a803902a5363336
343+
731e0a4c76189b2b55f4c705ccbb0105d3ee72c0
344344
```
345345

346346
`bip39` and `slip39` output formats can be combined with the `random` (default) input format. If the `--count N` option is used with the `hex` input format, it results in a seed of `N` bytes being generated and used.
@@ -506,36 +506,36 @@ $ seedtool --out dice
506506
#
507507
508508
$ seedtool --in dice 5343553122555345
509-
122540402a49e1abb75c9d2754db1ce1
509+
5d1c30bbc6f3cfd070067b63c851ffe7
510510
511511
#
512512
# Construct SLIP39 share from seed.
513513
#
514514
515-
$ seedtool --in hex --out slip39 122540402a49e1abb75c9d2754db1ce1
516-
device aluminum academic academic crush engage exercise acquire genuine necklace radar twice tension photo float walnut remove lecture maximum biology
515+
$ seedtool --in hex --out slip39 5d1c30bbc6f3cfd070067b63c851ffe7
516+
edge enlarge academic academic body necklace surprise resident burden taxi painting slim research teammate peasant ivory weapon gesture voice flexible
517517
518518
#
519519
# Recover the seed from the SLIP39 share.
520520
#
521521
522-
$ seedtool --in slip39 "device aluminum academic academic crush engage exercise acquire genuine necklace radar twice tension photo float walnut remove lecture maximum biology"
523-
122540402a49e1abb75c9d2754db1ce1
522+
$ seedtool --in slip39 "edge enlarge academic academic body necklace surprise resident burden taxi painting slim research teammate peasant ivory weapon gesture voice flexible"
523+
5d1c30bbc6f3cfd070067b63c851ffe7
524524
525525
#
526526
# Again construct SLIP39 share from the same seed. Notice the
527527
# share is different than last time.
528528
#
529529
530-
$ seedtool --in hex --out slip39 122540402a49e1abb75c9d2754db1ce1
531-
aunt branch academic academic declare pajamas firefly costume wrote advocate payroll ting answer graduate helpful column dilemma realize cylinder stilt
530+
$ seedtool --in hex --out slip39 5d1c30bbc6f3cfd070067b63c851ffe7
531+
result leader academic academic apart length alcohol adult patrol military counter enjoy animal standard club facility belong rumor problem answer
532532
533533
#
534534
# Recover the second share and notice that the seed is the same.
535535
#
536536
537-
$ seedtool --in slip39 "aunt branch academic academic declare pajamas firefly costume wrote advocate payroll ting answer graduate helpful column dilemma realize cylinder stilt"
538-
122540402a49e1abb75c9d2754db1ce1
537+
$ seedtool --in slip39 "result leader academic academic apart length alcohol adult patrol military counter enjoy animal standard club facility belong rumor problem answer"
538+
5d1c30bbc6f3cfd070067b63c851ffe7
539539
```
540540

541541

@@ -563,7 +563,7 @@ d551108c3e7831532beded6b29438683
563563
#
564564
565565
$ seedtool --deterministic test2
566-
68b275e740cb5f89bb5444694aaa2dbc82ab6aa4d9869b3995cb6aa3c622e6d1
566+
a97770028023ece0f9307bf867b4c740
567567
```
568568

569569
In this example, the same entropy is used twice in producing a SLIP39 share, which would normally result in two different shares being produced. But by providing `--deterministic FOOBAR`, the same results are produced.
@@ -581,29 +581,58 @@ $ seedtool --deterministic FOOBAR --out dice
581581
#
582582
583583
$ seedtool --in dice 1533324122434244
584-
b00248aedff06ea356a6f0e362ed8a07
584+
5cd271b50b98a869da1c26a526e1d3a8
585585
586586
#
587587
# Display our seed as a SLIP39 2-of-3 shares, using
588588
# deterministic randomness.
589589
#
590590
591-
$ seedtool --deterministic FOOBAR --in hex --out slip39 --group 2-of-3 b00248aedff06ea356a6f0e362ed8a07
592-
response lunch academic acid counter angel bucket trust guitar increase divorce stilt gasoline junk hearing crunch sprinkle sheriff pile salon
593-
response lunch academic agency buyer wisdom salary mason superior tracks glasses picture adult capacity ultimate pistol biology enjoy snake satisfy
594-
response lunch academic always alto wrap scroll music entrance easy lunch describe champion receiver artwork mouse false morning thunder video
591+
$ seedtool --deterministic FOOBAR --in hex --out slip39 --group 2-of-3 5cd271b50b98a869da1c26a526e1d3a8
592+
response lunch academic acid breathe ocean mixture traffic object sheriff rapids victim froth testify retreat patent prize human usual hobo
593+
response lunch academic agency activity fiber escape research earth pipeline prevent prepare activity erode grumpy problem justice vampire tension custody
594+
response lunch academic always crisis cards chemical expect muscle anxiety training thunder climate plan geology bulb scatter teacher gravity guilt
595595
596596
#
597597
# Do all of the above on a single line, and note that because
598598
# of deterministic randomness, the same final output is produced.
599599
#
600600
601601
$ seedtool --deterministic FOOBAR --out dice | seedtool --in dice | seedtool --deterministic FOOBAR --in hex --out slip39 --group 2-of-3
602-
response lunch academic acid counter angel bucket trust guitar increase divorce stilt gasoline junk hearing crunch sprinkle sheriff pile salon
603-
response lunch academic agency buyer wisdom salary mason superior tracks glasses picture adult capacity ultimate pistol biology enjoy snake satisfy
604-
response lunch academic always alto wrap scroll music entrance easy lunch describe champion receiver artwork mouse false morning thunder video
602+
response lunch academic acid breathe ocean mixture traffic object sheriff rapids victim froth testify retreat patent prize human usual hobo
603+
response lunch academic agency activity fiber escape research earth pipeline prevent prepare activity erode grumpy problem justice vampire tension custody
604+
response lunch academic always crisis cards chemical expect muscle anxiety training thunder climate plan geology bulb scatter teacher gravity guilt
605+
```
606+
607+
## Compatibility
608+
609+
* seedtool has been tested to give the same results as [Ian Coleman's BIP39 tool](https://iancoleman.io/bip39/) for the following input methods: `base6`, `base10`, `bits`, and `dice`.
610+
* `hex` as an input method is already compatible if used with his tool in "raw entropy" mode.
611+
* `cards` is not currently compatible.
612+
613+
The example below can be replicated using Coleman's tool and selecting the following options:
614+
615+
* Show entropy
616+
* Base: 10
617+
* Entropy: 123456
618+
* Mnemonic length: 12 words
619+
620+
```
621+
$ seedtool --in base10 123456 | seedtool --in hex --out bip39
622+
mirror reject rookie talk pudding throw happy era myth already payment owner
605623
```
606624

607625
## Version History
608626

609-
**1.0.0b1, 4/8/2020:** First test release.
627+
### 0.1.1, 4/8/2020
628+
629+
* Added compatibility with Ian Coleman's BIP39 tool for several input formats:
630+
* `base6`, `base10`, `bits`, and `dice` are now compatible.
631+
* `hex` as an input method is already compatible if used with his tool in "raw entropy" mode.
632+
* `cards` is not compatible as his algorithm is complex and possibly not worth spending the time on.
633+
* Updated MANUAL.md examples to remain accurate.
634+
* Added a section on Compatibility with other tools to MANUAL.md.
635+
636+
### 0.1.0, 4/8/2020
637+
638+
* First test release.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ We do ask that you offer us good faith and use best efforts not to leak informat
9191

9292
## Reporting a Vulnerability
9393

94-
Please report suspected security vulnerabilities in private via email to ChristopherA@LifeWithAlacrity.com (do not use this email for support). Please do NOT create publicly viewable issues for suspected security vulnerabilities.
94+
Please report suspected security vulnerabilities in private via email to ChristopherA@BlockchainCommons.com (do not use this email for support). Please do NOT create publicly viewable issues for suspected security vulnerabilities.
9595

9696
The following keys may be used to communicate sensitive information to developers:
9797

configure

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for bc-seedtool-cli 1.0.0b1.
3+
# Generated by GNU Autoconf 2.69 for bc-seedtool-cli 0.1.1.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
577577
# Identity of this package.
578578
PACKAGE_NAME='bc-seedtool-cli'
579579
PACKAGE_TARNAME='bc-seedtool-cli'
580-
PACKAGE_VERSION='1.0.0b1'
581-
PACKAGE_STRING='bc-seedtool-cli 1.0.0b1'
580+
PACKAGE_VERSION='0.1.1'
581+
PACKAGE_STRING='bc-seedtool-cli 0.1.1'
582582
PACKAGE_BUGREPORT=''
583583
PACKAGE_URL=''
584584

@@ -1231,7 +1231,7 @@ if test "$ac_init_help" = "long"; then
12311231
# Omit some internal or obsolete options to make the list less imposing.
12321232
# This message is too long to be a string in the A/UX 3.1 sh.
12331233
cat <<_ACEOF
1234-
\`configure' configures bc-seedtool-cli 1.0.0b1 to adapt to many kinds of systems.
1234+
\`configure' configures bc-seedtool-cli 0.1.1 to adapt to many kinds of systems.
12351235
12361236
Usage: $0 [OPTION]... [VAR=VALUE]...
12371237
@@ -1292,7 +1292,7 @@ fi
12921292

12931293
if test -n "$ac_init_help"; then
12941294
case $ac_init_help in
1295-
short | recursive ) echo "Configuration of bc-seedtool-cli 1.0.0b1:";;
1295+
short | recursive ) echo "Configuration of bc-seedtool-cli 0.1.1:";;
12961296
esac
12971297
cat <<\_ACEOF
12981298
@@ -1374,7 +1374,7 @@ fi
13741374
test -n "$ac_init_help" && exit $ac_status
13751375
if $ac_init_version; then
13761376
cat <<\_ACEOF
1377-
bc-seedtool-cli configure 1.0.0b1
1377+
bc-seedtool-cli configure 0.1.1
13781378
generated by GNU Autoconf 2.69
13791379
13801380
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1885,7 +1885,7 @@ cat >config.log <<_ACEOF
18851885
This file contains any messages produced by compilers while
18861886
running configure, to aid debugging if configure makes a mistake.
18871887
1888-
It was created by bc-seedtool-cli $as_me 1.0.0b1, which was
1888+
It was created by bc-seedtool-cli $as_me 0.1.1, which was
18891889
generated by GNU Autoconf 2.69. Invocation command line was
18901890
18911891
$ $0 $@
@@ -4868,7 +4868,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
48684868
# report actual input values of CONFIG_FILES etc. instead of their
48694869
# values after options handling.
48704870
ac_log="
4871-
This file was extended by bc-seedtool-cli $as_me 1.0.0b1, which was
4871+
This file was extended by bc-seedtool-cli $as_me 0.1.1, which was
48724872
generated by GNU Autoconf 2.69. Invocation command line was
48734873
48744874
CONFIG_FILES = $CONFIG_FILES
@@ -4930,7 +4930,7 @@ _ACEOF
49304930
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
49314931
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
49324932
ac_cs_version="\\
4933-
bc-seedtool-cli config.status 1.0.0b1
4933+
bc-seedtool-cli config.status 0.1.1
49344934
configured by $0, generated by GNU Autoconf 2.69,
49354935
with options \\"\$ac_cs_config\\"
49364936

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.69])
5-
AC_INIT([bc-seedtool-cli], [1.0.0b1])
5+
AC_INIT([bc-seedtool-cli], [0.1.1])
66
AC_CONFIG_SRCDIR([src/seedtool.cpp])
77
AC_CONFIG_HEADERS([src/config.h])
88

src/format-base10.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@
1515

1616
void FormatBase10::process_input(Params* p) {
1717
auto input = p->get_one_argument();
18+
19+
#if 0
1820
auto entropy = digits_to_data(input, 0, 9);
1921
p->seed = deterministic_random(entropy, p->count);
22+
#else
23+
// Compatibility with https://iancoleman.io/bip39/
24+
digits_to_data(input, 0, 9); // syntax check only
25+
p->seed = sha256_deterministic_random(input, p->count);
26+
#endif
2027
}
2128

2229
void FormatBase10::process_output(Params* p) {

src/format-base6.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@
1515

1616
void FormatBase6::process_input(Params* p) {
1717
auto input = p->get_one_argument();
18+
19+
#if 0
1820
auto entropy = digits_to_data(input, 0, 5);
1921
p->seed = deterministic_random(entropy, p->count);
22+
#else
23+
// Compatibility with https://iancoleman.io/bip39/
24+
digits_to_data(input, 0, 5); // syntax check only
25+
p->seed = sha256_deterministic_random(input, p->count);
26+
#endif
2027
}
2128

2229
void FormatBase6::process_output(Params* p) {

src/format-bits.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@
1515

1616
void FormatBits::process_input(Params* p) {
1717
auto input = p->get_one_argument();
18+
19+
#if 0
1820
auto entropy = digits_to_data(input, 0, 1);
1921
p->seed = deterministic_random(entropy, p->count);
22+
#else
23+
// Compatibility with https://iancoleman.io/bip39/
24+
digits_to_data(input, 0, 1); // syntax check only
25+
p->seed = sha256_deterministic_random(input, p->count);
26+
#endif
2027
}
2128

2229
void FormatBits::process_output(Params* p) {

0 commit comments

Comments
 (0)