You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
524 B
25 lines
524 B
3 years ago
|
package crypto
|
||
|
|
||
|
import "io"
|
||
|
|
||
|
// Cipher is message encryption utility struct.
|
||
|
type Cipher struct {
|
||
|
rand io.Reader
|
||
|
encryptSide Side
|
||
|
}
|
||
|
|
||
|
// Rand returns random generator.
|
||
|
func (c Cipher) Rand() io.Reader {
|
||
|
return c.rand
|
||
|
}
|
||
|
|
||
|
// NewClientCipher creates new client-side Cipher.
|
||
|
func NewClientCipher(rand io.Reader) Cipher {
|
||
|
return Cipher{rand: rand, encryptSide: Client}
|
||
|
}
|
||
|
|
||
|
// NewServerCipher creates new server-side Cipher.
|
||
|
func NewServerCipher(rand io.Reader) Cipher {
|
||
|
return Cipher{rand: rand, encryptSide: Server}
|
||
|
}
|