Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for wordlist alphabetization error #5

Merged
merged 2 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ config.h
config.log
config.status
*.tar.gz
autom4te.cache/
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ You can import a key by running the following command with that individual’s f

## Version History

### 0.2.0, 10/4/2020

* Fix for [https://github.com/BlockchainCommons/Research/issues/45](wordlist alphabetization error).

### 0.1.1, 7/1/2020

* Moved to depending on bc-crypto-base for calculation of CRC32 checksum.
Expand Down
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for bc-bytewords 0.1.1.
# Generated by GNU Autoconf 2.69 for bc-bytewords 0.2.0.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='bc-bytewords'
PACKAGE_TARNAME='bc-bytewords'
PACKAGE_VERSION='0.1.1'
PACKAGE_STRING='bc-bytewords 0.1.1'
PACKAGE_VERSION='0.2.0'
PACKAGE_STRING='bc-bytewords 0.2.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1225,7 +1225,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures bc-bytewords 0.1.1 to adapt to many kinds of systems.
\`configure' configures bc-bytewords 0.2.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1286,7 +1286,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of bc-bytewords 0.1.1:";;
short | recursive ) echo "Configuration of bc-bytewords 0.2.0:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1366,7 +1366,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
bc-bytewords configure 0.1.1
bc-bytewords configure 0.2.0
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1848,7 +1848,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by bc-bytewords $as_me 0.1.1, which was
It was created by bc-bytewords $as_me 0.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -4306,7 +4306,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by bc-bytewords $as_me 0.1.1, which was
This file was extended by bc-bytewords $as_me 0.2.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -4368,7 +4368,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
bc-bytewords config.status 0.1.1
bc-bytewords config.status 0.2.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([bc-bytewords], [0.1.1])
AC_INIT([bc-bytewords], [0.2.0])
AC_CONFIG_SRCDIR([src/bc-bytewords.c])
AC_CONFIG_HEADERS([config.h])

Expand Down
2 changes: 1 addition & 1 deletion src/bc-bytewords.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <ctype.h>
#include <bc-crypto-base/bc-crypto-base.h>

static const char* bytewords = "ableacidalsoapexaquaarchatomauntawayaxisbackbaldbarnbeltbetabiasbluebodybragbrewbulbbuzzcalmcashcatschefcityclawcodecolacookcostcruxcurlcuspcyandarkdatadaysdelidicedietdoordowndrawdropdrumdulldutyeacheasyechoedgeepicevenexamexiteyesfactfairfernfigsfilmfishfizzflapflewfluxfoxyfreefrogfuelfundgalagamegeargemsgiftgirlglowgoodgraygrimgurugushgyrohalfhanghardhawkheathelphighhillholyhopehornhutsicedideaidleinchinkyintoirisironitemjadejazzjoinjoltjowljudojugsjumpjunkjurykeepkenokeptkeyskickkilnkingkitekiwiknoblamblavalazyleaflegsliarlistlimplionlogoloudloveluaulucklungmainmanymathmazememomenumeowmildmintmissmonknailnavyneednewsnextnoonnotenumbobeyoboeomitonyxopenovalowlspaidpartpeckplaypluspoempoolposepuffpumapurrquadquizraceramprealredorichroadrockroofrubyruinrunsrustsafesagascarsetssilkskewslotsoapsolosongstubsurfswantacotasktaxitenttiedtimetinytoiltombtoystriptunatwinuglyundouniturgeuservastveryvetovialvibeviewvisavoidvowswallwandwarmwaspwavewaxywebswhatwhenwhizwolfworkyankyawnyellyogayurtzapszestzinczonezoomzero";
static const char* bytewords = "ableacidalsoapexaquaarchatomauntawayaxisbackbaldbarnbeltbetabiasbluebodybragbrewbulbbuzzcalmcashcatschefcityclawcodecolacookcostcruxcurlcuspcyandarkdatadaysdelidicedietdoordowndrawdropdrumdulldutyeacheasyechoedgeepicevenexamexiteyesfactfairfernfigsfilmfishfizzflapflewfluxfoxyfreefrogfuelfundgalagamegeargemsgiftgirlglowgoodgraygrimgurugushgyrohalfhanghardhawkheathelphighhillholyhopehornhutsicedideaidleinchinkyintoirisironitemjadejazzjoinjoltjowljudojugsjumpjunkjurykeepkenokeptkeyskickkilnkingkitekiwiknoblamblavalazyleaflegsliarlimplionlistlogoloudloveluaulucklungmainmanymathmazememomenumeowmildmintmissmonknailnavyneednewsnextnoonnotenumbobeyoboeomitonyxopenovalowlspaidpartpeckplaypluspoempoolposepuffpumapurrquadquizraceramprealredorichroadrockroofrubyruinrunsrustsafesagascarsetssilkskewslotsoapsolosongstubsurfswantacotasktaxitenttiedtimetinytoiltombtoystriptunatwinuglyundouniturgeuservastveryvetovialvibeviewvisavoidvowswallwandwarmwaspwavewaxywebswhatwhenwhizwolfworkyankyawnyellyogayurtzapszerozestzinczonezoom";

static bool decode_word(const char* in_word, size_t word_len, uint8_t* out_index) {
static int16_t* array = NULL;
Expand Down
30 changes: 15 additions & 15 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ static bool test_decode(bw_style style, const char* encoded, uint8_t input[], si
void test1() {
uint8_t input[] = {0, 1, 2, 128, 255};
size_t input_len = 5;
assert(test_encode(bw_standard, input, input_len, "able acid also lava zero jade need echo taxi"));
assert(test_encode(bw_uri, input, input_len, "able-acid-also-lava-zero-jade-need-echo-taxi"));
assert(test_encode(bw_minimal, input, input_len, "aeadaolazojendeoti"));
assert(test_encode(bw_standard, input, input_len, "able acid also lava zoom jade need echo taxi"));
assert(test_encode(bw_uri, input, input_len, "able-acid-also-lava-zoom-jade-need-echo-taxi"));
assert(test_encode(bw_minimal, input, input_len, "aeadaolazmjendeoti"));

assert(test_decode(bw_standard, "able acid also lava zero jade need echo taxi", input, input_len));
assert(test_decode(bw_uri, "able-acid-also-lava-zero-jade-need-echo-taxi", input, input_len));
assert(test_decode(bw_minimal, "aeadaolazojendeoti", input, input_len));
assert(test_decode(bw_standard, "able acid also lava zoom jade need echo taxi", input, input_len));
assert(test_decode(bw_uri, "able-acid-also-lava-zoom-jade-need-echo-taxi", input, input_len));
assert(test_decode(bw_minimal, "aeadaolazmjendeoti", input, input_len));

// bad checksum
assert(!test_decode(bw_standard, "able acid also lava zero jade need echo wolf", input, input_len));
Expand Down Expand Up @@ -86,25 +86,25 @@ void test2() {

char* encoded =
"yank toys bulb skew when warm free fair tent swan "
"open brag mint noon jury lion view tiny brew note "
"body data webs what zone bald join runs data whiz "
"days keys user diet news ruby whiz zoom menu surf "
"open brag mint noon jury list view tiny brew note "
"body data webs what zinc bald join runs data whiz "
"days keys user diet news ruby whiz zone menu surf "
"flew omit trip pose runs fund part even crux fern "
"math visa tied loud redo silk curl jugs hard beta "
"next cost puma drum acid junk swan free very mint "
"flap warm fact math flap what list free jugs yell "
"flap warm fact math flap what limp free jugs yell "
"fish epic whiz open numb math city belt glow wave "
"list fuel grim free zoom open love diet gyro cats "
"limp fuel grim free zone open love diet gyro cats "
"fizz holy city puff";
assert(test_encode(bw_standard, input, input_len, encoded));
assert(test_decode(bw_standard, encoded, input, input_len));

char* encoded_minimal =
"yktsbbswwnwmfefrttsnonbgmtnnjylnvwtybwne"
"bydawswtzebdjnrsdawzdsksurdtnsrywzzmmusf"
"yktsbbswwnwmfefrttsnonbgmtnnjyltvwtybwne"
"bydawswtzcbdjnrsdawzdsksurdtnsrywzzemusf"
"fwottppersfdptencxfnmhvatdldroskcljshdba"
"ntctpadmadjksnfevymtfpwmftmhfpwtltfejsyl"
"fhecwzonnbmhcybtgwweltflgmfezmonledtgocs"
"ntctpadmadjksnfevymtfpwmftmhfpwtlpfejsyl"
"fhecwzonnbmhcybtgwwelpflgmfezeonledtgocs"
"fzhycypf";
assert(test_encode(bw_minimal, input, input_len, encoded_minimal));
assert(test_decode(bw_minimal, encoded_minimal, input, input_len));
Expand Down