Documentation ¶
Overview ¶
Package cryptonight implements CryptoNight hash function and some of its variant. Original CryptoNight algorithm is defined in CNS008 at https://cryptonote.org/cns/cns008.txt
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHash ¶
CheckHash checks hash's difficulty against diff. It returns true if hash's difficulty is equal to or greater than diff.
if len(hash) != 32, the return value is always false.
CheckHash should be prefered over Difficulty if you only want to check if some hash passes a specific difficulty, as CheckHash is very fast and requires no heap allocation. It actually checks (hashDiff * diff) < 2^256 instead of calculating the exact value of hashDiff.
This function is a port of monero: src/cryptonote_basic/difficulty.cpp:check_hash
This isn't a part of CryptoNight, but since such demand of checking difficulty is too common, it is thus included in this package.
func Difficulty ¶
Difficulty returns hash's difficulty.
If len(hash) != 32, the return value is always 0.
Difficulty is slower than CheckHash, so it should only be used when necessary, for example when you want to tell the exact difficulty value of a hash.
This isn't a part of CryptoNight, but since such demand of checking difficulty is too common, it is thus included in this package.
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package groestl implements Grøstl-256 algorithm.
|
Package groestl implements Grøstl-256 algorithm. |
internal
|
|
aes
Package aes implements AES utilities for CryptoNight usage.
|
Package aes implements AES utilities for CryptoNight usage. |
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |
Package jh implements JH-256 algorithm.
|
Package jh implements JH-256 algorithm. |