secure

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

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

Go to latest
Published: Dec 22, 2015 License: MIT Imports: 8 Imported by: 0

README

secure

secure encrypts and decrypts data, as well as obtaining key based on the password (using PBKDF2).

Example

package main

import (
	"fmt"

	"github.com/AntonMezhanskiy/secure"
)

func main() {
	var plaintext = []byte("Привет, Мир!")
	var pass = []byte("password")
	var salt = []byte("salt")
	var key = secure.GenerateKey(pass, salt)

	a, _ := secure.EncryptData(plaintext, key)
	b, _ := secure.DecryptData(a, key)
	fmt.Println(string(b))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptData

func DecryptData(ciphertext, key []byte) (plaintext []byte, err error)

func EncryptData

func EncryptData(plaintext, key []byte) (ciphertext []byte, err error)

func GenerateKey

func GenerateKey(pass, salt []byte) (key []byte)

Types

This section is empty.

Jump to

Keyboard shortcuts

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