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.
24 lines
524 B
24 lines
524 B
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} |
|
}
|
|
|