crsuite

package module
v0.0.0-...-0bc1647 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: MIT Imports: 5 Imported by: 0

README

crypto-suite

crypto-suite is a golang package containing useful cryptographic tools.

A full list of all tools and their usage can be found in the project wiki

Usage

To get the package use:

$ go get githib.com/ARaChn3/crypto-suite

To use this package, simply import it using the following:

import csuite "githib.com/ARaChn3/crypto-suite"

Assigning alias: csuite


Biblography

Kudos to this article for an amazing explanation of how RSA encryption works: https://www.sohamkamani.com/golang/rsa-encryption/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decrypt

func Base64Decrypt(ciphertext []byte) ([]byte, error)

Base64Decrypt decodes a base64 encoded string and returns result.

func Base64Encrypt

func Base64Encrypt(plaintext []byte) []byte

Base64Encrypt performs base64 encoding on plaintext and returns it

func GenerateKeyPairs

func GenerateKeyPairs(bits int) (*rsa.PrivateKey, error)

GenerateKeyPairs generates private and public keys for RSA encryption. the returned type: *rsa.PrivateKey contains the public key under the field named: PublicKey

func ROTDecrypt

func ROTDecrypt(ciphertext string, offset uint) string

ROTDecrypt performs ROTn decryption on plaintext and returns it. The offset specified is taken as a negative value by the function, using which, ROTn operation is performed.

func ROTEncrypt

func ROTEncrypt(plaintext string, offset uint) (res string)

ROTEncrypt performs a ROTn encryption on [plaintext] using [offset] and returns it. It is important to note that the ROT encryption performed on plaintext is using right-hand rotation of the text.

func RSADecrypt

func RSADecrypt(ciphertext []byte, privateKey *rsa.PrivateKey) ([]byte, error)

RSADecrypt decrypts ciphertext using privateKey and returns the plaintext thus obtained.

func RSAEncrypt

func RSAEncrypt(plaintext []byte, keySize int) (ciphertext []byte, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, err error)

RSAEncrypt encrypts plaintext using the RSA (Rivest–Shamir–Adleman) encryption algorithm.

Types

This section is empty.

Jump to

Keyboard shortcuts

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