From cab357a160cf4fdf4eb7c17c35c703e1e1f0ab10 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 13 Dec 2023 12:47:16 -0800 Subject: Rename SHA-512/256 to the more appropriate SHA-512Half --- doc/ledger.1 | 4 ++-- doc/ledger3.texi | 2 +- src/session.h | 4 ++-- src/utils.h | 2 +- test/baseline/opt-hashes-sha512_256.test | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/ledger.1 b/doc/ledger.1 index 619f6c45..8c502cfa 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -1,4 +1,4 @@ -.Dd November 30, 2023 +.Dd December 13, 2023 .Dt LEDGER 1 .Os .Sh NAME @@ -642,7 +642,7 @@ metadata value, according to the hashing algorithm given by the argument. Supported algorithms are .Ar sha512 or -.Ar sha512_256 +.Ar sha512_half where both use SHA512, but the latter only stores the first half of the hash value. .Pp diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 123b589d..f6cc6230 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -6770,7 +6770,7 @@ The support algorithms are: @table @code @item sha512 Use the SHA512 hashing algorithm. -@item sha512_256 +@item sha512_half Same as SHA512, but record only the first 256 bits. @end table diff --git a/src/session.h b/src/session.h index c83be644..ef26b58e 100644 --- a/src/session.h +++ b/src/session.h @@ -170,8 +170,8 @@ public: DO_(str) { if (str == "sha512" || str == "SHA512") { hash_type = HASH_SHA512; - } else if (str == "sha512_256" || str == "SHA512_256") { - hash_type = HASH_SHA512_256; + } else if (str == "sha512_half" || str == "SHA512_Half") { + hash_type = HASH_SHA512_Half; } else { throw_(std::invalid_argument, _f("Unrecognized hash type")); } diff --git a/src/utils.h b/src/utils.h index 34308807..bc05ff4f 100644 --- a/src/utils.h +++ b/src/utils.h @@ -608,7 +608,7 @@ extern const string version; enum hash_type_t { NO_HASHES = 0, HASH_SHA512 = 1, - HASH_SHA512_256 = 2 + HASH_SHA512_Half = 2 }; } // namespace ledger diff --git a/test/baseline/opt-hashes-sha512_256.test b/test/baseline/opt-hashes-sha512_256.test index f269652d..b8751786 100644 --- a/test/baseline/opt-hashes-sha512_256.test +++ b/test/baseline/opt-hashes-sha512_256.test @@ -10,7 +10,7 @@ Assets:Cash Expenses:Books $20.00 -test print --hashes=sha512_256 +test print --hashes=sha512_half 2008/01/01 January ; Hash: c0f3322857def0d32bd2c9398e0785aacc8206f9ba64ef923978cbdcea13f59c Expenses:Books $10.00 -- cgit v1.2.3