From e739ca2ef2748cab9577274eff88e32921ab9dc3 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 23 Jul 2018 10:48:26 -0700 Subject: [PATCH] Rename AttemptSaplingEncDecryptionUsingFullViewingKey and use function overloading. --- src/gtest/test_noteencryption.cpp | 2 +- src/zcash/Note.cpp | 4 ++-- src/zcash/Note.hpp | 2 +- src/zcash/NoteEncryption.cpp | 2 +- src/zcash/NoteEncryption.hpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gtest/test_noteencryption.cpp b/src/gtest/test_noteencryption.cpp index 2861e0983..a674daf65 100644 --- a/src/gtest/test_noteencryption.cpp +++ b/src/gtest/test_noteencryption.cpp @@ -113,7 +113,7 @@ TEST(noteencryption, NotePlaintext) ASSERT_TRUE(decrypted_out_ct_unwrapped.esk == out_pt.esk); // Test sender can decrypt the note ciphertext. - foo = SaplingNotePlaintext::decryptUsingFullViewingKey( + foo = SaplingNotePlaintext::decrypt( ct, epk, decrypted_out_ct_unwrapped.esk, diff --git a/src/zcash/Note.cpp b/src/zcash/Note.cpp index 81d5457c1..1108e1db5 100644 --- a/src/zcash/Note.cpp +++ b/src/zcash/Note.cpp @@ -208,14 +208,14 @@ boost::optional SaplingNotePlaintext::decrypt( return ret; } -boost::optional SaplingNotePlaintext::decryptUsingFullViewingKey( +boost::optional SaplingNotePlaintext::decrypt( const SaplingEncCiphertext &ciphertext, const uint256 &epk, const uint256 &esk, const uint256 &pk_d ) { - auto pt = AttemptSaplingEncDecryptionUsingFullViewingKey(ciphertext, epk, esk, pk_d); + auto pt = AttemptSaplingEncDecryption(ciphertext, epk, esk, pk_d); if (!pt) { return boost::none; } diff --git a/src/zcash/Note.hpp b/src/zcash/Note.hpp index b9f24f2e2..5a3e55dfe 100644 --- a/src/zcash/Note.hpp +++ b/src/zcash/Note.hpp @@ -133,7 +133,7 @@ public: const uint256 &epk ); - static boost::optional decryptUsingFullViewingKey( + static boost::optional decrypt( const SaplingEncCiphertext &ciphertext, const uint256 &epk, const uint256 &esk, diff --git a/src/zcash/NoteEncryption.cpp b/src/zcash/NoteEncryption.cpp index fe8962dbb..63e073265 100644 --- a/src/zcash/NoteEncryption.cpp +++ b/src/zcash/NoteEncryption.cpp @@ -187,7 +187,7 @@ boost::optional AttemptSaplingEncDecryption( return plaintext; } -boost::optional AttemptSaplingEncDecryptionUsingFullViewingKey ( +boost::optional AttemptSaplingEncDecryption ( const SaplingEncCiphertext &ciphertext, const uint256 &epk, const uint256 &esk, diff --git a/src/zcash/NoteEncryption.hpp b/src/zcash/NoteEncryption.hpp index 202d9a715..f6e692028 100644 --- a/src/zcash/NoteEncryption.hpp +++ b/src/zcash/NoteEncryption.hpp @@ -73,9 +73,9 @@ boost::optional AttemptSaplingEncDecryption( const uint256 &epk ); -// Attempts to decrypt a Sapling note using full viewing key. +// Attempts to decrypt a Sapling note using outgoing plaintext. // This will not check that the contents of the ciphertext are correct. -boost::optional AttemptSaplingEncDecryptionUsingFullViewingKey ( +boost::optional AttemptSaplingEncDecryption ( const SaplingEncCiphertext &ciphertext, const uint256 &epk, const uint256 &esk,