lib

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

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

Go to latest
Published: Oct 13, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

README

lib

func RandStringWithCharset(length int, charset string) string

Returns a random string with length and a charset (e.g. "abcdefghijklmnopqrstuvwxyz0123456789").

str = RandStringWithCharset(5,"abcd")

The above command will return a string of length = 5 having random characters from the set "abcd".

func RandString(length int) string

Returns a random string with length and the charset ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789").

str = RandString(5)

The above command will return a random string of length = 5.

func ShuffleIntSlice(slice []int)

shuffles all entries of an []int

arr:= [5]int{1,2,3,4,5}
ShuffleIntSlice(arr[:])

func ShuffleStringSlice(slice []string)

shuffles all entries of an []string

string_arr:= [3]string{"git","rocks","hello"}
ShuffleStringSlice(string_arr[:])

func ShuffleByteSlice(slice []byte)

shuffles all entries of an []byte

byte_arr:= [3]byte{'g','r','h'}
ShuffleByteSlice(byte_arr[:])

func UpArrow(base uint64, exponant uint64, upArrowAmount uint64) uint64

computes the upArrow function (https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation)

res = UpArrow(2,4,1) //output will be 16

func GetRequestContentFromRequest(req *http.Request) map[string]interface{}

returns the JSON from an http.Request

func GetRequestContentFromResponse(resp *http.Response) map[string]interface{}

returns the JSON from an http.Response

func IntRange(args ...int) <-chan int

takes 1 to 3 arguments

for one argument:
  • IntRange(10) returns :
  • 0 1 2 3 4 5 6 7 8 9
for two arguments:
  • IntRange(10, 20) returns :
  • 10 11 12 13 14 15 16 17 18 19
for three arguments:
  • IntRange(20, 0, -1) returns :
  • 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1

func SieveOfEratosthenes(numberOfPrimes int64) []int64

returns a slice of prime numbers smaller than the parameter numberOfPrimes.

  • SieveOfEratosthenes(20) returns :
  • 2 3 5 7 11 13 17 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(key *[]byte, cipherText []byte) (plainText []byte)

Decrypts a text with aes in gcm mode nad returns it as a byte - array The nonce will be extract from the first 12 bytes from the cipherText

The key parameter represents the symmetric key which will be used to decrypt a text

The cipherText parameter represents the text which will be encrypted

func AESEncrypt

func AESEncrypt(key *[]byte, plainText []byte) (cipherText []byte)

Encrypts a text with aes in gcm mode and returns it as byte - array For every encryption will be a new nonce (12 byte) generated and placed at the start of the ciphertext

The key parameter represents the symmetric key which will be used to encrypt a text

The plainText parameter represents the text which will be encrypted

func GetRequestContentFromRequest

func GetRequestContentFromRequest(req *http.Request) map[string]interface{}

func GetRequestContentFromResponse

func GetRequestContentFromResponse(resp *http.Response) map[string]interface{}

func IntRange

func IntRange(args ...int) <-chan int

func IsPrime

func IsPrime(number int64) bool

func RandString

func RandString(length int) string

RandString returns functionCall StringWithCharset

func RandStringWithCharset

func RandStringWithCharset(length int, charset string) string

RandStringWithCharset forms a string with the random seed and the charset

func ShuffleByteSlice

func ShuffleByteSlice(slice []byte)

ShuffleByteSlice ...

func ShuffleIntSlice

func ShuffleIntSlice(slice []int)

ShuffleIntSlice ...

func ShuffleStringSlice

func ShuffleStringSlice(slice []string)

ShuffleStringSlice ...

func SieveOfEratosthenes

func SieveOfEratosthenes(numberOfPrimes int64) []int64

SieveOfEratosthenes returns an Slice of primenumbers smaller than the given paramter

func UpArrow

func UpArrow(base uint64, exponant uint64, upArrowAmount uint64) uint64

UpArrow ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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