cipher

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MIT Imports: 1 Imported by: 0

README

Ssi Core / Cipher

This package has been developed for password encrypt/decrypt operations in microservices.

Encrypt

Encrypts the given password with the given salt.

example:

package main

import(
	"github.com/ssibrahimbas/ssi-core/pkg/cipher"
)

func main() {
    c := cipher.New()
    encrypted, err := c.Encrypt("test")
    if err != nil {
        panic(err)
    }
    fmt.Println(encrypted)
}

Compare

Compares the given password with the given encrypted password.

example:

package main

import(
	"github.com/ssibrahimbas/ssi-core/pkg/cipher"
)

func main() {
    c := cipher.New()
    encrypted, err := c.Encrypt("test")
    if err != nil {
        panic(err)
    }
    equal, err := c.Compare("test1", encrypted)
    if err != nil {
        panic(err)
    }
    fmt.Println(equal)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher struct{}

func New

func New() *Cipher

func (*Cipher) Compare

func (c *Cipher) Compare(t string, h []byte) (bool, error)

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(t string) ([]byte, error)

Jump to

Keyboard shortcuts

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