aboutsummaryrefslogtreecommitdiff
path: root/src/mnemonics/electrum-words.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-11-09 10:56:53 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-11-09 10:58:10 +0000
commit2d1ccc1b882c46e3b988a641314c15dd33eb5e66 (patch)
tree7c714388e40c0036243dab81e1c4f4974046b499 /src/mnemonics/electrum-words.h
parentMerge pull request #2605 (diff)
downloadmonero-2d1ccc1b882c46e3b988a641314c15dd33eb5e66.tar.xz
mnemonics: support for arbitrary (if multiple of 4 bytes) length data
Diffstat (limited to 'src/mnemonics/electrum-words.h')
-rw-r--r--src/mnemonics/electrum-words.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mnemonics/electrum-words.h b/src/mnemonics/electrum-words.h
index 94ce9c200..941768352 100644
--- a/src/mnemonics/electrum-words.h
+++ b/src/mnemonics/electrum-words.h
@@ -64,6 +64,17 @@ namespace crypto
/*!
* \brief Converts seed words to bytes (secret key).
* \param words String containing the words separated by spaces.
+ * \param dst To put the secret data restored from the words.
+ * \param len The number of bytes to expect, 0 if unknown
+ * \param duplicate If true and len is not zero, we accept half the data, and duplicate it
+ * \param language_name Language of the seed as found gets written here.
+ * \return false if not a multiple of 3 words, or if word is not in the words list
+ */
+ bool words_to_bytes(std::string words, std::string& dst, size_t len, bool duplicate,
+ std::string &language_name);
+ /*!
+ * \brief Converts seed words to bytes (secret key).
+ * \param words String containing the words separated by spaces.
* \param dst To put the secret key restored from the words.
* \param language_name Language of the seed as found gets written here.
* \return false if not a multiple of 3 words, or if word is not in the words list
@@ -72,6 +83,17 @@ namespace crypto
std::string &language_name);
/*!
+ * \brief Converts bytes to seed words.
+ * \param src Secret data
+ * \param len Secret data length in bytes (positive multiples of 4 only)
+ * \param words Space delimited concatenated words get written here.
+ * \param language_name Seed language name
+ * \return true if successful false if not. Unsuccessful if wrong key size.
+ */
+ bool bytes_to_words(const char *src, size_t len, std::string& words,
+ const std::string &language_name);
+
+ /*!
* \brief Converts bytes (secret key) to seed words.
* \param src Secret key
* \param words Space delimited concatenated words get written here.