Questions tagged [keccak]

A cryptographic hash algorithm which uses a sponge construction. Use this tag for questions which relate to the use and implementation of the Keccak sponge function family in general. For questions which relate specifically to the SHA-3 family of hash functions, use the sha-3 tag instead. SHA-3 is powered by Keccak, but the two terms are not the same.

Keccak is a cryptographic hash algorithm which uses a sponge construction. An input message is "absorbed" into the sponge state, and then the hash result is "squeezed" out of the sponge state. The state is subjected to permutations after each block of data has been read into and out of the sponge. By repeatedly squeezing the sponge, Keccak allows output of an arbitrary length.

Details of the algorithm can be found at the Keccak sponge function family homepage.

Keccak was submitted as a candidate for the NIST (National Institute of Standards and Technology) SHA-3 Competition, and was selected as the winner in October of 2012.

Keccak powers the SHA-3 family of hash functions, but SHA-3 is just a subset of the possible Keccak applications. It is important not to confuse the two terms Keccak and SHA-3. While SHA-3 specifies exact settings for each of its functions, the Keccak sponge family permits a large variety of configurations. The parameters which define a Keccak sponge construction are:

bitrate: the maximum number of bits which can be absorbed or squeezed before the state will be permuted.

capacity: the number of bits within the sponge state which are not directly modified by an absorption and not directly read by a squeeze, but which do play a part in the permutation of the state.

domain suffix: an optional sequence of bits which will be appended to the end of the original message, before padding is applied. The domain suffix allows differentiation between different Keccak applications (such as SHA3, SHAKE, RawSHAKE, etc).

output length: the length in bits of the hash result which will be generated.

The sum of the bitrate and the capacity give the "width" of the permutation state, and this width must be one of: 25, 50, 100, 200, 400, 800, 1600. The bitrate, capacity, and output length must each be greater than zero. Beyond that, Keccak is very flexible.

66 questions
15
votes
1 answer

How can I find keccak 256 hash in Python

I am using Python 2.7 and need to find keccak hash for solidity events. However I don't see a default lib for the same. I installed sha3 but it doesn't seem to provide this functionality. Tried pysha3 with below code import sha3 k =…
garg10may
  • 5,794
  • 11
  • 50
  • 91
6
votes
2 answers

QCryptographicHash - what is SHA3 here in reality?

I got such a piece of code: void SHAPresenter::hashData(QString data) { QCryptographicHash* newHash = new QCryptographicHash(QCryptographicHash::Sha3_224); newHash->addData(data.toUtf8()); QByteArray hashResultByteArray =…
pklimczu
  • 626
  • 1
  • 6
  • 15
6
votes
1 answer

In solidity, keccak 256 function returns a hash value. How many bits does keccak 256 return?

I used the following command : keccak256('abc', 'pqr', 123); I get a value once I run this. How many bit value is this?
Rahul Sharma
  • 329
  • 1
  • 3
  • 10
5
votes
1 answer

"\x19Ethereum Signed Message:\n32" Prefix Meaning

I was searching through the internet for the meaning of this prefix. Solidity docs do not have a clear explanation. So what is this and why should I use it? "\x19Ethereum Signed Message:\n32",
juice
  • 49
  • 2
5
votes
1 answer

npm error "Keccak bindings compilation fail." while installing truffle

I tried to install Truffle, but then I got this error: $ npm install -g truffle C:\Users\dany.vandermeij\AppData\Roaming\npm\truffle -> C:\Users\dany.vandermeij\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js > keccak@1.4.0…
BlockchainProgrammer
  • 1,999
  • 5
  • 20
  • 32
4
votes
1 answer

Using Google Cloud Key Management Service to sign an Ethereum transaction

I've been working on writing a signer service for an Ethereum transaction manager and I need to sign Ethereum transactions using Google KMS Golang APIs. I'll try and summarise the problems I'm facing below. Ethereum requires compact RLP encoded…
4
votes
3 answers

Sha-3 in python implementation

I am trying to implement sha-3 in python.The code given below is how I implemented it.But i am getting the below error again and again. import sys import hashlib arg1 = sys.argv[1] with open(arg1, 'r') as myfile: …
saki
  • 63
  • 1
  • 2
  • 5
4
votes
1 answer

Keccak-256 in PHP

I need to create hashes with Keccak-256 algorithm (NOT SHA3). I'm running PHP 7.1, and when I call to hash_algos() returns me the registered algorithms but Keccak-256 doesn't exist. The supported algorithms are: [0] => md2 [1] => md4 [2] => md5 [3]…
Synkronice
  • 179
  • 1
  • 9
4
votes
1 answer

Different hashes for Keccak / SHA-3 with several programs?

I am developing the keccak sponge function and have some strange behaviour about the hash result. I use the string "abc" with 24 bits (3 bytes). The test vectors for SHA-3 on http://www.di-mgt.com.au/sha_testvectors.html say that the result of…
Burak
  • 343
  • 1
  • 3
  • 12
4
votes
1 answer

Simple way to understanding implementation of SHA-3 Keccak hashing algorithm

I have been looking for references about the algorithm keccak on the internet, but none make me understand. Here are some links that I…
Tomero Indonesia
  • 1,685
  • 2
  • 16
  • 17
3
votes
0 answers

How to use multiple leaves with one proof in merkletreejs & solidity?

I am trying to use merkletreejs in node to create a hexproof - using one it works fine but I also need it to be able to generate one proof for multiple leaves. My current js code: const { MerkleTree } = require('merkletreejs'); const keccak256 =…
730wavy
  • 944
  • 1
  • 19
  • 57
3
votes
2 answers

Merkle Proof in python using Keccak256

I'm trying to create a whitelist for an NFT using a Merkle tree to save on gas costs. I saw a great implementation here, in javascript, but I would like to do it in Python. Doesn't seem like I'm able to create a merkle tree using keccak hashing,…
frankied003
  • 466
  • 6
  • 26
3
votes
2 answers

How decrypt keccak algorithm

I am preparing a presentation about Keccak (http://keccak.noekeon.org/). In that presentation, I would like to encrypt a plain-text – which brings up the following questions: What is the exact role of the padding function (how do we obtain a cube…
user2404953
  • 41
  • 1
  • 1
  • 2
3
votes
3 answers

Password hashing: Keccak or not

The winner of SHA-3 hashing algorithm contest has been chosen. The winner's algorithm is Keccak. I use Blowfish and really like it, but Keccak is said to be better. Is it worth to use it for storing user's passwords on my website? If yes, are there…
TheJSB
  • 151
  • 1
  • 9
3
votes
2 answers

Have Keccak (SHA-3) example hashes (test vectors) been made available?

I'm interested in implementing Keccak (SHA-3) and would like a set of input/expected output pairs to test against. Have any official test vectors been released? I recall having some for the other SHA routines and they were very helpful.
fbrereto
  • 35,429
  • 19
  • 126
  • 178
1
2 3 4 5