MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / New

Method New

cmd/bitrot.go:47–64  ·  view source on GitHub ↗

New returns a new hash.Hash calculating the given bitrot algorithm.

()

Source from the content-addressed store, hash-verified

45
46// New returns a new hash.Hash calculating the given bitrot algorithm.
47func (a BitrotAlgorithm) New() hash.Hash {
48 switch a {
49 case SHA256:
50 return sha256.New()
51 case BLAKE2b512:
52 b2, _ := blake2b.New512(nil) // New512 never returns an error if the key is nil
53 return b2
54 case HighwayHash256:
55 hh, _ := highwayhash.New(magicHighwayHash256Key) // New will never return error since key is 256 bit
56 return hh
57 case HighwayHash256S:
58 hh, _ := highwayhash.New(magicHighwayHash256Key) // New will never return error since key is 256 bit
59 return hh
60 default:
61 logger.CriticalIf(GlobalContext, errors.New("Unsupported bitrot algorithm"))
62 return nil
63 }
64}
65
66// Available reports whether the given algorithm is available.
67func (a BitrotAlgorithm) Available() bool {

Callers 15

mainFunction · 0.80
CreateMetadataMethod · 0.80
GenerateKeyFunction · 0.80
SealMethod · 0.80
UnsealMethod · 0.80
DerivePartKeyMethod · 0.80
SealETagMethod · 0.80
UnsealETagMethod · 0.80
EncryptSinglePartFunction · 0.80
DecryptSinglePartFunction · 0.80
CreateMetadataMethod · 0.80
HashStringFunction · 0.80

Calls 2

NewFunction · 0.92
CriticalIfFunction · 0.92

Tested by 15

TestEvalFunction · 0.64
TestParseBucketSSEConfigFunction · 0.64
TestParseObjectLegalHoldFunction · 0.64
TestMainFunction · 0.64
TestNetworkError_UnwrapFunction · 0.64
newRandStringFunction · 0.64
TestReadFailuresFunction · 0.64
TestParseStorageClassFunction · 0.64
sendMethod · 0.64
CloseMethod · 0.64
IsActiveMethod · 0.64
Test_readFromSecretFunction · 0.64