-
Notifications
You must be signed in to change notification settings - Fork 5
/
cryptogo.go
41 lines (35 loc) · 1.46 KB
/
cryptogo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright 2013-2014 Vasiliy Gorin. All rights reserved.
// Use of this source code is governed by a GNU-style
// license that can be found in the LICENSE file.
/*
Package cryptogo implements some useful cryptography-related functions:
1. Hashes:
1.1. hash.MD5Bytes
calculates an MD5 checksum of the input byte array as a byte array
1.2. hash.MD5Base64
calculates an MD5 checksum of the input byte array as a base64-encoded string
1.3. hash.MD5Hex
calculates an MD5 checksum of the input byte array as a hex-encoded string
2. Password-based (PB):
2.1. pb.PBAesEncrypt
encrypts input byte array using string password specified into a new (encrypted) byte array
2.2. pb.PBAesDecrypt
decrypts input byte array using string password specified into a new (decrypted) byte array
2.3. pb.PBSignRequest
signs an http request using a string password; adds 2 additional headers to the request
2.4. pb.PBVerifyRequest
verifies previously signed http request using a string password
3. Paddings
3.1. pad.Pkcs5Pad
adds PKCS #5 padding to an input byte array, returning new (padded) byte array
3.2. pad.Pkcs5Unpad
removes PKCS #5 padding from an input byte array, returning new (striped) byte array
4. Random
4.1. rnd.RandomBytes
generates a random byte array of the specified length
4.2. IV
synonym for RandomBytes, used to generate random IV
4.3. Salt
synonym for RandomBytes, used to generate random Salt
*/
package cryptogo