crypt

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 1 Imported by: 1

README

encryption

Abilities

Key ALGORITHMS
  1. PBKDF2 build key off password
  2. Scrypt build key off password (better alternative to #1)
ENCRYPTION ALGORITHM/TRANSFORMATION
  1. AES/CBC/PKCS5Padding Encrypt/Decrypt using prior keys (with AES PKCS7Padding is actually used)
MAC
  1. Poly1305
TERMS
  • Password is passed by user

  • Salt is a unique salt for the system this will be running on and doesn't change

  • IV or nonce is generated on every encryption and is part of the combination of a key return

NOTES

golang-crypto

exploring-1password-crypto

data-encryption-in-go-using-openssl

golang cipher

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSalt

func GenSalt(salt []byte, length int) []byte

GenSalt generate a salt if one doesn't exist of the length specified

Example
package main

import log "github.com/colt3k/nglog/ng"

func main() {

	var dataset = []int{10, 20, 30, 5, 20}

	var data []byte
	for i, d := range dataset {
		if data != nil {
			data = GenSalt(data, d)
		} else {
			data = GenSalt(nil, d)
		}
		show(data, i, d)
		if i > 0 {
			data = nil
		}
	}

}

func show(data []byte, idx, size int) {
	log.Println(idx, "DataSize", len(string(data)), "should be:", size)
}
Output:

func GenerateRandomBytes

func GenerateRandomBytes(length int) []byte

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

Types

This section is empty.

Directories

Path Synopsis
some parts from https://github.com/jsha/minica/blob/master/main.go
some parts from https://github.com/jsha/minica/blob/master/main.go

Jump to

Keyboard shortcuts

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