Skip to content
Liesware edited this page Apr 15, 2019 · 22 revisions

Hash

HASH functions video

Security

Symmetric  |   ECC   |  DH/DSA/RSA  | HASH
-----------+---------+--------------+-----
    80     |   163   |     1024     | 160 
   112     |   233   |     2048     | 224
   128     |   283   |     3072     | 256
   192     |   409   |     7680     | 384
   256     |   571   |    15360     | 512

            Comparable Key Sizes (in bits)

SHA3

spec

Descriptopn: It is the latest member of the Secure Hash Algorithm family of standards, released by NIST.

Outputs: 512, 384, 256, 224.

Uses: General propuse, 3GPP TS 35.231, FIPS 202 , SP 800-185. TUAK, NIST, FIPS.

SHA2 & SHA1

spec

SHA1 video

Description: NSA cryptographic hash functions.

Outputs: SHA2: 512, 384, 256, 224. SHA1: 160

Uses: General propuse, backward compatibility. NIST, FIPS.

Whirlpool

spec

Description: Hash based on AES.

Outputs: 512

Uses: Performance is not impportant, ISO/IEC 10118-3, NESSIE, ISO ,IEC.

Blake2b

spec

Description: Faster hash than SHA-3, SHA2, SHA1, MD5 and at least as secure as the latest standard SHA-3.

Outputs: 512

Uses: Performance is impportant, RFC 7693,

SipHash

spec

Description: SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) optimized for speed on short messages.Target applications include network traffic authentication and defense against hash-flooding DoS attacks.

Outputs: 128

How to ???

#!/usr/bin/env python

import socket
import json
import os,binascii

def sending(message):
	ip = '127.0.0.1'
	port = 6613
	BUFFER_SIZE = 65536
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	s.connect((ip, port))
	s.send(message)
	data = s.recv(BUFFER_SIZE)
        print data
	s.close()
	return data

data_js='{"version":1,"algorithm":"SHA3_512","type":"string","plaintext":"Hello world!"}'
sending(data_js)

In this example we get SHA3_512 for Hello world! string

  • On data_js["algorithm"] can be one of {SHA3_512, SHA3_384, SHA3_256, SHA3_224, SHA_512, SHA_384, SHA_256, SHA_224, SHA_1, WHIRLPOOL, BLAKE2B, SIPHASH}
data_js='{"version":1,"algorithm":"WHIRLPOOL","type":"string","plaintext":"48656c6c6f20776f726c64210d0a0d0a","hex":1}'

In this example We get WHIRLPOOL for 48656c6c6f20776f726c64210d0a0d0 string.

  • "hex":1 indicates the string is a hex string
  • "hex":0 indicates the string is a ascii string
  • When hex doesn't appear indicates the same as "hex":0
  • hex parameter only applies for when "type":"string"
  • hex parameter indicates if the string is hex or ascii.
data_js='{"version":1,"algorithm":"SHA_1","type":"file","file":"mayhem.txt"}'

In this example we get SHA_1 for mayhem.txt file

  • On "type":"file" the parameter "hex" isn't needed
  • On "file":"route to file" indicates where is the file. It depends on where Coherence is running.
  • On data_js["type"] can be file or string
  • type indicates if you are going to apply the algorithm on a file or on a string.

Json to hash string

{"version":1,"algorithm":" hash flavor","type":"string","plaintext":"your string", "hex":BOOL}

Json to hash file

{"version":1,"algorithm":"hash flavor","type":"file","file":"your file"}
You can’t perform that action at this time.