streebog

package module
v0.0.0-...-2d9b8ff Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

README

Функция хеширования Стрибог (ГОСТ 34.11 - 2018)

Проект реализует функции хеширования Стрибог с длинами хеш-кода 256 и 512 бит, реализующий интерфейс hash.Hash.

Установка

go get github.com/beldmian/streebog

Пример использования

HASH
package main

import (
	"fmt"

	"github.com/beldmian/streebog"
)

func main() {
	message := []byte("any-message")
	hash := streebog.New(64)
	hash.Write(message)
	fmt.Printf("Hash: %x\n", hash.Sum(nil))
}


HMAC
package main

import (
	"crypto/hmac"
	"fmt"
	"hash"

	"github.com/beldmian/streebog"
)

func main() {
	key := []byte("any-key")
	message := []byte("any-message")
	h := hmac.New(func() hash.Hash { return streebog.New(32) }, key)
	h.Write(message)
	fmt.Printf("Hash: %x\n", h.Sum(nil))
}

Производительность

~60 kH/s

benchmark-results

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(size int) hash.Hash

Types

This section is empty.

Directories

Path Synopsis
cmd
hash command
hmac command
examples
512 command
hmac command
pkg

Jump to

Keyboard shortcuts

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