Documentation ¶
Index ¶
- Constants
- Variables
- func CheckMAC(message, messageMAC, key []byte) bool
- func Decrypt(message, key []byte) ([]byte, error)
- func DeriveKeys(key []byte) (aes_key, mac_key []byte)
- func Encrypt(message, key []byte) ([]byte, error)
- func HMAC(message, key []byte) []byte
- func Jaccard(set1, set2 []string) float64
- func Key(password, salt []byte, iter int) []byte
- func Salt() ([]byte, error)
- type BoltDB
- type Client
- func (c *Client) AddDocToKeyword(keyword, doc string) error
- func (c *Client) Count(keyword string) (int, error)
- func (c *Client) Delete(id string) error
- func (c *Client) Get(id string) ([]byte, error)
- func (c *Client) Put(id string, doc []byte) error
- func (c *Client) Search(keyword string) (ids []string, err error)
- func (c *Client) SetCount(keyword string, count int) error
- func (c *Client) SetKey(passphrase, salt string, iter int)
- type DBConn
Constants ¶
View Source
const ( DOCUMENTS = "documents" COUNTS = "counts" INDEX = "index" )
View Source
const (
BlobSize = 10 // Size of array holding doc IDs
)
View Source
const HMACSize = sha256.Size
Variables ¶
View Source
var One = []byte{0x01} // Needed for different keys.
View Source
var Two = []byte{0x02}
Functions ¶
func DeriveKeys ¶
func Encrypt ¶
Encrypt takes a message and a key (both as []byte) and will encrypt the message with AES using the supplied key. The key must be an appropriate length for AES:
16 = AES-128 24 = AES-192 32 = AES-256
The message is padded with PKCS#7 Padding and the IV is prepended to the ciphertext returned.
For authentication, the HMAC of the encrypted is appended to the ciphertext returned.
Types ¶
type BoltDB ¶
func BoltDBOpen ¶
type Client ¶
type Client struct { DB DBConn // contains filtered or unexported fields }
func (*Client) AddDocToKeyword ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.