hierogolyph: github.com/evalphobia/hierogolyph Index | Files

package hierogolyph

import "github.com/evalphobia/hierogolyph"

Index

Package Files

config.go hash.go hierogolyph.go rand.go strings.go

func HashHMAC Uses

func HashHMAC(plainText, key string) string

HashHMAC returns a HMAC signed message using the given key.

func HashSHA256 Uses

func HashSHA256(data string) string

HashSHA256 returns the SHA256 checksum of the data.

type Config Uses

type Config struct {
    // Cipher is the main algorithm to encrypt/decrypt text.
    // (e,g, AES GCM)
    Cipher cipher.Cipher

    // HSM is Hardware Security Module
    // (e.g. AWS KMS)
    HSM hsm.HSM

    // Hasher is hashing algorithm.
    // (e.g. Argon2, Scrypt)
    Hasher hasher.Hasher

    // HMACKey is the key used for signing message with HMAC.
    HMACKey string
}

type Hierogolyph Uses

type Hierogolyph struct {
    Config

    Password      string
    Salt          string
    EncryptionKey string // generated by password and salt, used for encryption/decryption and verifying password.
}

Hierogolyph treats encryption and decryption.

func CreateHierogolyph Uses

func CreateHierogolyph(password string, conf Config) (Hierogolyph, error)

CreateHierogolyph creates new Hierogolyph from given password, which is used for encryption. (after the first encryption, don't use this constructor.)

func (Hierogolyph) Decrypt Uses

func (h Hierogolyph) Decrypt(cipherText string) (plainText string, err error)

Decrypt decrypts given cipherText.

func (Hierogolyph) Encrypt Uses

func (h Hierogolyph) Encrypt(plainText string) (cipherText string, err error)

Encrypt encrypts given plainText.

func (*Hierogolyph) SetEncryptionKey Uses

func (h *Hierogolyph) SetEncryptionKey() error

SetEncryptionKey sets an encryption key generated from password and salt.

func (Hierogolyph) Unlock Uses

func (h Hierogolyph) Unlock() (cek string, err error)

Unlock creates Content Encryption Key.

Package hierogolyph imports 11 packages (graph). Updated 2020-12-03. Refresh now. Tools for package owners.