aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-10-05 18:30:28 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2016-10-06 21:53:40 +0800
commitaefb6e5fcf9adc7c58da9ec0454707305f7e9ac9 (patch)
tree30d17c29abf022cfcde24d13ebbd9285aadeb62b /libdevcore
parentd5cfb17b32147e950a689a507e0d5487dece7e8a (diff)
downloaddexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.tar
dexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.tar.gz
dexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.tar.bz2
dexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.tar.lz
dexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.tar.xz
dexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.tar.zst
dexon-solidity-aefb6e5fcf9adc7c58da9ec0454707305f7e9ac9.zip
Rename dev::sha3 to dev::keccak256
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/ABI.h2
-rw-r--r--libdevcore/SHA3.cpp6
-rw-r--r--libdevcore/SHA3.h16
3 files changed, 12 insertions, 12 deletions
diff --git a/libdevcore/ABI.h b/libdevcore/ABI.h
index 5b7d160d..423cfda8 100644
--- a/libdevcore/ABI.h
+++ b/libdevcore/ABI.h
@@ -63,7 +63,7 @@ template <class T, class ... U> bytes abiInAux(T const& _t, U const& ... _u)
template <class ... T> bytes abiIn(std::string _id, T const& ... _t)
{
- return sha3(_id).ref().cropped(0, 4).toBytes() + abiInAux(_t ...);
+ return keccak256(_id).ref().cropped(0, 4).toBytes() + abiInAux(_t ...);
}
template <class T> struct ABIDeserialiser {};
diff --git a/libdevcore/SHA3.cpp b/libdevcore/SHA3.cpp
index 584ef07e..774a11b0 100644
--- a/libdevcore/SHA3.cpp
+++ b/libdevcore/SHA3.cpp
@@ -207,14 +207,14 @@ defsha3(512)
}
-unsigned g_sha3Counter = 0;
+unsigned g_keccak256Counter = 0;
-bool sha3(bytesConstRef _input, bytesRef o_output)
+bool keccak256(bytesConstRef _input, bytesRef o_output)
{
// FIXME: What with unaligned memory?
if (o_output.size() != 32)
return false;
- ++g_sha3Counter;
+ ++g_keccak256Counter;
keccak::sha3_256(o_output.data(), 32, _input.data(), _input.size());
// keccak::keccak(ret.data(), 32, (uint64_t const*)_input.data(), _input.size());
return true;
diff --git a/libdevcore/SHA3.h b/libdevcore/SHA3.h
index 5393952f..b2a84c74 100644
--- a/libdevcore/SHA3.h
+++ b/libdevcore/SHA3.h
@@ -34,26 +34,26 @@ namespace dev
/// Calculate SHA3-256 hash of the given input and load it into the given output.
/// @returns false if o_output.size() != 32.
-bool sha3(bytesConstRef _input, bytesRef o_output);
+bool keccak256(bytesConstRef _input, bytesRef o_output);
/// Calculate SHA3-256 hash of the given input, returning as a 256-bit hash.
-inline h256 sha3(bytesConstRef _input) { h256 ret; sha3(_input, ret.ref()); return ret; }
+inline h256 keccak256(bytesConstRef _input) { h256 ret; keccak256(_input, ret.ref()); return ret; }
/// Calculate SHA3-256 hash of the given input, returning as a 256-bit hash.
-inline h256 sha3(bytes const& _input) { return sha3(bytesConstRef(&_input)); }
+inline h256 keccak256(bytes const& _input) { return keccak256(bytesConstRef(&_input)); }
/// Calculate SHA3-256 hash of the given input (presented as a binary-filled string), returning as a 256-bit hash.
-inline h256 sha3(std::string const& _input) { return sha3(bytesConstRef(_input)); }
+inline h256 keccak256(std::string const& _input) { return keccak256(bytesConstRef(_input)); }
/// Calculate SHA3-256 hash of the given input (presented as a FixedHash), returns a 256-bit hash.
-template<unsigned N> inline h256 sha3(FixedHash<N> const& _input) { return sha3(_input.ref()); }
+template<unsigned N> inline h256 keccak256(FixedHash<N> const& _input) { return keccak256(_input.ref()); }
/// Calculate SHA3-256 hash of the given input, possibly interpreting it as nibbles, and return the hash as a string filled with binary data.
-inline std::string sha3(std::string const& _input, bool _isNibbles) { return asString((_isNibbles ? sha3(fromHex(_input)) : sha3(bytesConstRef(&_input))).asBytes()); }
+inline std::string keccak256(std::string const& _input, bool _isNibbles) { return asString((_isNibbles ? keccak256(fromHex(_input)) : keccak256(bytesConstRef(&_input))).asBytes()); }
/// Calculate SHA3-256 MAC
-inline void sha3mac(bytesConstRef _secret, bytesConstRef _plain, bytesRef _output) { sha3(_secret.toBytes() + _plain.toBytes()).ref().populate(_output); }
+inline void keccak256mac(bytesConstRef _secret, bytesConstRef _plain, bytesRef _output) { keccak256(_secret.toBytes() + _plain.toBytes()).ref().populate(_output); }
-extern unsigned g_sha3Counter;
+extern unsigned g_keccak256Counter;
}