From db0661dbb51e9082e47926c31e93bdc97b491bf9 Mon Sep 17 00:00:00 2001
From: John Wiegley <johnw@newartisans.com>
Date: Wed, 22 Nov 2023 16:47:21 -0800
Subject: Add support for hash chaining to detect modifications in postings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The following details of a posting contribute to its hash:

  fullname of account
  string representation of amount

Each posting hashes contributes to the transaction hash, which is compromised
of:

  previous transaction’s hash (as encountered in parsing order)
  actual date
  optional auxiliary date
  optional code
  payee
  hashes of all postings

Note that this means that changes in the “code” or any of the comments
---
 src/item.h | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/item.h')

diff --git a/src/item.h b/src/item.h
index 84f062ab..9221098e 100644
--- a/src/item.h
+++ b/src/item.h
@@ -199,6 +199,10 @@ public:
     return _state;
   }
 
+  virtual string hash(string _nonce) const {
+    return "";
+  }
+
   virtual void define(const symbol_t::kind_t, const string&,
                       expr_t::ptr_op_t);
   virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind,
-- 
cgit v1.2.3