Reorganize crypto code

Move all crypto functions to package "crypto", move random generators
for tests into helper package.
This commit is contained in:
Alexander Neumann
2015-04-12 09:36:14 +02:00
parent 8e8f31d3fe
commit 3a2525809c
10 changed files with 166 additions and 187 deletions

19
crypto/buffer_pool.go Normal file
View File

@@ -0,0 +1,19 @@
package crypto
import "sync"
const defaultBufSize = 2048
var bufPool = sync.Pool{
New: func() interface{} {
return make([]byte, defaultBufSize)
},
}
func getBuffer() []byte {
return bufPool.Get().([]byte)
}
func freeBuffer(buf []byte) {
bufPool.Put(buf)
}