balloon

package module
v0.0.0-...-d22693c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2022 License: GPL-3.0 Imports: 3 Imported by: 1

README

Balloon password hashing library written on pure Go. Forked from git://git.cypherpunks.ru/balloon.git
For Balloon hashing description look: https://crypto.stanford.edu/balloon/
This library is free software: see the file COPYING.LESSER for copying conditions.

Documentation

Overview

Package balloon Look https://crypto.stanford.edu/balloon/ for more description.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B

func B(h hash.Hash, passwd, salt []byte, sCost, tCost uint64) []byte

B takes hash, password, salt, space cost (buffer size, number of hash-output sized blocks), time cost (number of rounds) and performs the following:

# Expand input into buffer.
buf[0] = hash(cnt++ || passwd || salt)
for m from 1 to sCost-1:
    buf[m] = hash(cnt++ || buf[m-1])
# Mix buffer contents.
for t from 0 to tCost-1:
    for m from 0 to sCost-1:
        # Hash last and current blocks.
        prev = buf[(m-1) mod sCost]
        buf[m] = hash(cnt++ || prev || buf[m])
        # Hash in pseudorandomly chosen blocks.
        for i from 0 to delta-1:
            other = to_int(hash(cnt++ || salt || t || m || i)) mod sCost
            buf[m] = hash(cnt++ || buf[m] || buf[other])
# Extract output from buffer.
return buf[sCost-1]

func H

func H(hasher func() hash.Hash, passwd, salt []byte, sCost, tCost int, jobs int) []byte

H adds additional functionality over pure B(): ability to run several hashers (jobs) simultaneously and second-preimage resistant password double hashing.

H(p, s, jobs) = hash(p || s || (
    B(p, s || "1") XOR
    B(p, s || "2") XOR
    B(p, s || jobs)
))

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL