aboutsummaryrefslogtreecommitdiff
path: root/src/ringct/rctOps.cpp
diff options
context:
space:
mode:
authorShen Noether <Shen.Noether@gmx.com>2016-07-09 20:04:23 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:29:16 +0100
commitdbb5f2d6a3d34c0fa899fd26313873cc69dbad9d (patch)
treec0ec7fe483b6918479bfa62a65396f9800fad82d /src/ringct/rctOps.cpp
parentringct: "simple" ringct variant (diff)
downloadmonero-dbb5f2d6a3d34c0fa899fd26313873cc69dbad9d.tar.xz
ringct: optimization/cleanup of hash functions
Diffstat (limited to 'src/ringct/rctOps.cpp')
-rw-r--r--src/ringct/rctOps.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp
index 3fa870fd0..c18ee6f2b 100644
--- a/src/ringct/rctOps.cpp
+++ b/src/ringct/rctOps.cpp
@@ -423,6 +423,31 @@ namespace rct {
return rv;
}
+ //cn_fast_hash for a key-vector of arbitrary length
+ //this is useful since you take a number of keys
+ //put them in the key vector and it concatenates them
+ //and then hashes them
+ key cn_fast_hash(const keyV &keys) {
+ size_t l = keys.size();
+ vector<unsigned char> m(l * 32);
+ size_t i, j;
+ for (i = 0 ; i < l ; i++) {
+ for (j = 0 ; j < 32 ; j++) {
+ m[i * 32 + j] = keys[i][j];
+ }
+ }
+ key rv;
+ cn_fast_hash(rv, &m[0], 32 * l);
+ //dp(rv);
+ return rv;
+ }
+
+ key hash_to_scalar(const keyV &keys) {
+ key rv = cn_fast_hash(keys);
+ sc_reduce32(rv.bytes);
+ return rv;
+ }
+
key hashToPointSimple(const key & hh) {
key pointk;
ge_p1p1 point2;