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
2
votes
0 answers

i have a function in solidity ,i want return length of new random array generated

please can any one help me to get a new length of arandom array generated from this function What happens now is that the array length is returned to zero function randomArray(uint[] memory population ) public view returns(uint[] memory){ …
2
votes
4 answers

keccak.js Uncaught ReferenceError: Buffer is not defined

I have a little script in ReactJS : import './App.css'; import { useState, useEffect } from 'react'; //Import de la librairie ethers (comme web3.js) import { ethers } from 'ethers'; const { MerkleTree } = require('merkletreejs') const keccak256 =…
Ben BK
  • 154
  • 2
  • 11
2
votes
1 answer

How to find the original value from the keccak 256 hash value in python?

I'm using following code to get the keccak 256 hash: import sha3 k = sha3.keccak_256() k.update(b'age') print (k.hexdigest()) How do I convert the keccak 256 hash value back to original string? (I'm ok with using any library as needed).
aste123
  • 1,223
  • 4
  • 20
  • 40
2
votes
0 answers

How is 't' computed in the Rho round of the Keccak specifications?

I'm building a minimal-dependancy crypto library, working on a keccak implementation based on this specification document. I'm confused about following aspect of the t computation described in the paper among the group of calculations on page…
Ari Kanevsky
  • 63
  • 1
  • 5
2
votes
1 answer

Is the C# encryption library hashlib correct in it's implementation

Hashlib team, I am not sure whether the SHA3 library (Keccak) returns correct encryption. I used the latest source code (changeset 78295) downloaded from codeplex but it does not match the vector and result provided in the Wikipedia (sha3 page)…
2
votes
2 answers

Is it safe to cut the hash?

I would like to store hashes for approximately 2 billion strings. For that purpose I would like to use as less storage as possible. Consider an ideal hashing algorithm which returns hash as series of hexadecimal digits (like an md5 hash). As far as…
Termos
  • 664
  • 1
  • 7
  • 31
1
vote
0 answers

From Solidity To Dart : how reproduce an Solidity Address type construction in Dart

I have not managed to convert a line of code I have in one a Smart Contract of the back end of my DAPP into the Dart syntax for the front end part of it. SOLIDITY : address account =…
krizalyde
  • 11
  • 2
1
vote
1 answer

Invalid implicit conversion from address payable to bytes memory requested. This function requires a single bytes argument

function setBasicDetails(string memory _registrationNo, string memory _farmerName, string memory _farmAddress, string memory _exporterName, …
1
vote
0 answers

SHA3-512 after first theta iteration bit[3,0,0] is wrong

i'm trying to implement SHA3-512 in c++, and i've found this PDF where the state is printed at the end of every function. The first iteration, before theta function: line[0-4, 0] = A3A3A3A3A3A3A3A3(hex) line[0-3, 1] = A3A3A3A3A3A3A3A3(hex) line[4,…
Cammo
  • 11
  • 3
1
vote
2 answers

no new() in sha3::Keccak256 struct

I'm trying to get an ethereum public address from a hex private key. I wrote a rust script for that - extern crate hex; extern crate secp256k1; extern crate sha3; use secp256k1::{PublicKey, SecretKey}; use sha3::Keccak256; fn main() { let…
1
vote
0 answers

What is the create2 function's equivalent in javascript?

I imported this create library for the keccak encryptor: https://blog.8bitzen.com/posts/18-03-2019-keccak-abi-encodepacked-with-javascript/ Now I made a js function: const pair = soliditySha3( '0xff', factory.address, …
Yan Digilov
  • 166
  • 7
1
vote
0 answers

Difference between js and dart to generate an address with a private key

I would like to write this function written in js to dart Function in js import {ec as EC} from 'elliptic' import secp256k1 from 'secp256k1' import sha3 from 'js-sha3' const ec = new EC('secp256k1') export function privateKeyToAddress(key) { …
redDwarf
  • 336
  • 1
  • 9
1
vote
0 answers

Java Keccak-256 implementation incorrect hash on zero byte message

I have been trying to write my own implementation of Keccak-256 cryptographic hash function in Java. I have been using Keccak specifications summary and their Implementation Guide for reference. I want to test my implementation using a zero length…
acedogblast
  • 99
  • 1
  • 6
1
vote
1 answer

C++ Using Keccak Library

Im working on my bachelor thesis and I have to test some post quantum algorithms. I downloaded them from NIST. But when I tried DAGS: https://csrc.nist.gov/CSRC/media/Projects/Post-Quantum-Cryptography/documents/round-1/submissions/DAGS.zip and…
burdacz
  • 13
  • 2
1
vote
1 answer

Round Constants in Keccak

Recently, just for the heck of it, I've been playing around with an attempt at implementing Keccak, the cryptographic primitive behind SHA-3. I've run into some issues however, specifically with calculating the round constants used in the "Iota"…
Jeffrey
  • 1,271
  • 2
  • 15
  • 31