my computer is about to die!!!
This commit is contained in:
1 parent
d863dc3bd1
commit
e80f2601ab
13 files changed
+244
-11
No files matched your search
@@ -6,6 +6,8 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/didiercrunch/filou/contract"
|
||||
)
|
||||
|
||||
type BlockModeStream func(block cipher.Block, iv []byte) cipher.Stream
|
||||
@@ -32,6 +34,17 @@ func GetDefaultPayload(dataSource io.Reader) *Payload {
|
||||
}
|
||||
}
|
||||
|
||||
func GetPayload(dataSource io.Reader, acceptedContract *contract.AcceptedContract) (*Payload, error) {
|
||||
ret := &Payload{DataSource: dataSource, Random: rand.Reader}
|
||||
errs := make([]error, 0)
|
||||
var err error
|
||||
if ret.HashMethod, err = GetHashByHashName(acceptedContract.Hash); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
type payloadWriter struct {
|
||||
Reader io.Reader
|
||||
Pipewriter io.WriteCloser
|
||||
|
||||
Reference in new issue
Block a user