password

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 7 Imported by: 0

README

Package password

GoDoc

install:

go get github.com/archeopternix/password

usage:

package main

import (
	"fmt"

	. "github.com/archeopternix/password"
)

func main() {
	// create a new instance of PasswordCrypter using a secret
	ncp := NewPasswordCrypter("samplepass")

	// call the encryption with the 'string' that should be encrypted
	cryptstr := ncp.EncryptString("Hello World!")
	fmt.Println("Encrypted string: " + cryptstr)

	fmt.Println("Decrypted string: " + ncp.DecryptString((cryptstr)))
}

PasswordCrypter

PasswordCrypter is a helper for encrypting and decrypting passwords based on AES encryption standard and stores the secret for further calls. The secret must be at minimum 6 characters long

EncryptString

EncryptString encrypts a password string based on AES encryption standard the PasswordCrypter has to be initialized with a passphrase first

func (pc PasswordCrypter) EncryptString(data string) (encodedstring string)

DecryptString

DecryptString decrypts a password string based on AES encryption standard the PasswordCrypter has to be initialized with a passphrase first

func (pc PasswordCrypter) DecryptString(data string) (plaintext string) 

Documentation

Overview

password document

PasswordCrypter: is a helper for encrypting and decrypting passwords based on AES encryption standard

usage:

func main() {
	// create a new instance of PasswordCrypter using a secret
	ncp := NewPasswordCrypter("samplepass")
	// call the encryption with the 'password' that should be encrypted
	cryptstr := ncp.EncryptString("Hello World!")
}

The secret must be at minimum 6 characters long

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PasswordCrypter added in v0.1.1

type PasswordCrypter struct {
	// contains filtered or unexported fields
}

PasswordCrypter is a helper for encrypting and decrypting passwords based on AES encryption standard

func NewPasswordCrypter added in v0.1.1

func NewPasswordCrypter(secretpassphrase string) (pc PasswordCrypter)

NewPasswordCrypter creates a new instance of PasswordCrypter with a new secret string. the length of the secret passphrase must be at lease 6 characters long

func (PasswordCrypter) DecryptString added in v0.1.1

func (pc PasswordCrypter) DecryptString(data string) (plaintext string)

DecryptString decrypts a password string based on AES encryption standard the PasswordCrypter has to be initialized with a passphrase first

func (PasswordCrypter) EncryptString added in v0.1.1

func (pc PasswordCrypter) EncryptString(data string) (encodedstring string)

EncryptString encrypts a password string based on AES encryption standard the PasswordCrypter has to be initialized with a passphrase first

Jump to

Keyboard shortcuts

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