forked from TrueCloudLab/restic
3a2525809c
Move all crypto functions to package "crypto", move random generators for tests into helper package.
19 lines
267 B
Go
19 lines
267 B
Go
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)
|
|
}
|