Skip to content
Snippets Groups Projects
Commit 0d35a0b4 authored by Jonah Husson's avatar Jonah Husson
Browse files

Use jww panic instead of builtin for proper logging

parent eef29751
Branches
Tags
2 merge requests!65Updates for Channel Support,!62Use jww panic instead of builtin for proper logging
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package cmix package cmix
import ( import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
...@@ -30,7 +31,7 @@ func ClientEncrypt(grp *cyclic.Group, msg format.Message, ...@@ -30,7 +31,7 @@ func ClientEncrypt(grp *cyclic.Group, msg format.Message,
// Get the salt for associated data // Get the salt for associated data
hash, err := blake2b.New256(nil) hash, err := blake2b.New256(nil)
if err != nil { if err != nil {
panic("E2E Client Encrypt could not get blake2b Hash") jww.FATAL.Panicf("E2E Client Encrypt could not get blake2b Hash")
} }
hash.Reset() hash.Reset()
hash.Write(salt) hash.Write(salt)
......
...@@ -95,7 +95,7 @@ func (g *Group) NewInt(x int64) *Int { ...@@ -95,7 +95,7 @@ func (g *Group) NewInt(x int64) *Int {
val := large.NewInt(x) val := large.NewInt(x)
n := &Int{value: val, fingerprint: g.fingerprint} n := &Int{value: val, fingerprint: g.fingerprint}
if !g.Inside(n.value) { if !g.Inside(n.value) {
panic("NewInt: Attempted creation of cyclic outside of group") jww.FATAL.Panic("NewInt: Attempted creation of cyclic outside of group")
} }
return n return n
} }
...@@ -114,7 +114,7 @@ func (g *Group) NewIntFromBytes(buf []byte) *Int { ...@@ -114,7 +114,7 @@ func (g *Group) NewIntFromBytes(buf []byte) *Int {
val := large.NewIntFromBytes(buf) val := large.NewIntFromBytes(buf)
n := &Int{value: val, fingerprint: g.fingerprint} n := &Int{value: val, fingerprint: g.fingerprint}
if !g.Inside(n.value) { if !g.Inside(n.value) {
panic("NewIntFromBytes: Attempted creation of cyclic outside of group") jww.FATAL.Panic("NewIntFromBytes: Attempted creation of cyclic outside of group")
} }
return n return n
} }
...@@ -128,7 +128,7 @@ func (g *Group) NewIntFromString(str string, base int) *Int { ...@@ -128,7 +128,7 @@ func (g *Group) NewIntFromString(str string, base int) *Int {
} }
n := &Int{value: val, fingerprint: g.fingerprint} n := &Int{value: val, fingerprint: g.fingerprint}
if !g.Inside(n.value) { if !g.Inside(n.value) {
panic("NewIntFromString: Attempted creation of cyclic outside of group") jww.FATAL.Panic("NewIntFromString: Attempted creation of cyclic outside of group")
} }
return n return n
} }
...@@ -144,7 +144,7 @@ func (g *Group) NewIntFromUInt(i uint64) *Int { ...@@ -144,7 +144,7 @@ func (g *Group) NewIntFromUInt(i uint64) *Int {
val := large.NewIntFromUInt(i) val := large.NewIntFromUInt(i)
n := &Int{value: val, fingerprint: g.fingerprint} n := &Int{value: val, fingerprint: g.fingerprint}
if !g.Inside(n.value) { if !g.Inside(n.value) {
panic("NewIntFromUInt: Attempted creation of cyclic outside of group") jww.FATAL.Panic("NewIntFromUInt: Attempted creation of cyclic outside of group")
} }
return n return n
} }
...@@ -158,7 +158,7 @@ func (g *Group) NewIntFromBits(b large.Bits) *Int { ...@@ -158,7 +158,7 @@ func (g *Group) NewIntFromBits(b large.Bits) *Int {
fingerprint: g.fingerprint, fingerprint: g.fingerprint,
} }
if !g.Inside(n.value) { if !g.Inside(n.value) {
panic("NewIntFromBits: Attempted creation of cyclic outside of group") jww.FATAL.Panic("NewIntFromBits: Attempted creation of cyclic outside of group")
} }
return n return n
} }
......
...@@ -11,6 +11,7 @@ package diffieHellman ...@@ -11,6 +11,7 @@ package diffieHellman
import ( import (
"fmt" "fmt"
jww "github.com/spf13/jwalterweatherman"
"io" "io"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
...@@ -34,7 +35,7 @@ func GeneratePrivateKey(size int, group *cyclic.Group, source io.Reader) *cyclic ...@@ -34,7 +35,7 @@ func GeneratePrivateKey(size int, group *cyclic.Group, source io.Reader) *cyclic
k1, err := csprng.GenerateInGroup(group.GetPBytes(), size, source) k1, err := csprng.GenerateInGroup(group.GetPBytes(), size, source)
if err != nil { if err != nil {
panic(fmt.Sprintf("Failed to generate key: %s", err.Error())) jww.FATAL.Panic(fmt.Sprintf("Failed to generate key: %s", err.Error()))
} }
privateKey := group.NewIntFromBytes(k1) privateKey := group.NewIntFromBytes(k1)
......
...@@ -27,7 +27,7 @@ func Crypt(key, vector, msg []byte) (crypt []byte) { ...@@ -27,7 +27,7 @@ func Crypt(key, vector, msg []byte) (crypt []byte) {
cipher, err := chacha20.NewUnauthenticatedCipher(key[:], nonce) cipher, err := chacha20.NewUnauthenticatedCipher(key[:], nonce)
if err != nil { if err != nil {
panic(err) jww.FATAL.Panic(err)
} }
cipher.XORKeyStream(out, msg) cipher.XORKeyStream(out, msg)
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package e2e package e2e
import ( import (
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"golang.org/x/crypto/chacha20" "golang.org/x/crypto/chacha20"
) )
...@@ -21,7 +22,7 @@ func Crypt(key Key, fingerprint format.Fingerprint, msg []byte) []byte { ...@@ -21,7 +22,7 @@ func Crypt(key Key, fingerprint format.Fingerprint, msg []byte) []byte {
nonce := fingerprint[:chacha20.NonceSizeX] nonce := fingerprint[:chacha20.NonceSizeX]
cipher, err := chacha20.NewUnauthenticatedCipher(key[:], nonce) cipher, err := chacha20.NewUnauthenticatedCipher(key[:], nonce)
if err != nil { if err != nil {
panic(err) jww.FATAL.Panic(err)
} }
cipher.XORKeyStream(out, msg) cipher.XORKeyStream(out, msg)
// Return the result // Return the result
......
...@@ -11,6 +11,7 @@ package e2e ...@@ -11,6 +11,7 @@ package e2e
import ( import (
"fmt" "fmt"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/crypto/cyclic" "gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/primitives/format" "gitlab.com/elixxir/primitives/format"
"golang.org/x/crypto/blake2b" "golang.org/x/crypto/blake2b"
...@@ -32,7 +33,7 @@ func DeriveKey(basekey *cyclic.Int, keyNum uint32, salts ...[]byte) Key { ...@@ -32,7 +33,7 @@ func DeriveKey(basekey *cyclic.Int, keyNum uint32, salts ...[]byte) Key {
//get the hash //get the hash
h, err := blake2b.New256(nil) h, err := blake2b.New256(nil)
if err != nil { if err != nil {
panic(fmt.Sprintf("Failed to create hash for "+ jww.FATAL.Panic(fmt.Sprintf("Failed to create hash for "+
"DeriveKey: %s", err)) "DeriveKey: %s", err))
} }
...@@ -57,7 +58,7 @@ func DeriveKeyFingerprint(dhkey *cyclic.Int, keyNum uint32, salts ...[]byte) for ...@@ -57,7 +58,7 @@ func DeriveKeyFingerprint(dhkey *cyclic.Int, keyNum uint32, salts ...[]byte) for
//get the hash //get the hash
h, err := blake2b.New256(nil) h, err := blake2b.New256(nil)
if err != nil { if err != nil {
panic(fmt.Sprintf("Failed to create hash for "+ jww.FATAL.Panic(fmt.Sprintf("Failed to create hash for "+
"DeriveKeyFingerprint(): %s", err)) "DeriveKeyFingerprint(): %s", err))
} }
//derive the key //derive the key
......
...@@ -21,7 +21,7 @@ func MakeRelationshipFingerprint(pubkeyA, pubkeyB *cyclic.Int, sender, ...@@ -21,7 +21,7 @@ func MakeRelationshipFingerprint(pubkeyA, pubkeyB *cyclic.Int, sender,
receiver *id.ID) []byte { receiver *id.ID) []byte {
h, err := hash.NewCMixHash() h, err := hash.NewCMixHash()
if err != nil { if err != nil {
panic(fmt.Sprintf("Failed to get hash to make relationship"+ jww.FATAL.Panic(fmt.Sprintf("Failed to get hash to make relationship"+
" fingerprint with: %s", err)) " fingerprint with: %s", err))
} }
......
...@@ -36,7 +36,6 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw ...@@ -36,7 +36,6 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
...@@ -46,14 +45,11 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= ...@@ -46,14 +45,11 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/liyue201/goqr v0.0.0-20200803022322-df443203d4ea h1:uyJ13zfy6l79CM3HnVhDalIyZ4RJAyVfDrbnfFeJoC4= github.com/liyue201/goqr v0.0.0-20200803022322-df443203d4ea h1:uyJ13zfy6l79CM3HnVhDalIyZ4RJAyVfDrbnfFeJoC4=
github.com/liyue201/goqr v0.0.0-20200803022322-df443203d4ea/go.mod h1:w4pGU9PkiX2hAWyF0yuHEHmYTQFAd6WHzp6+IY7JVjE= github.com/liyue201/goqr v0.0.0-20200803022322-df443203d4ea/go.mod h1:w4pGU9PkiX2hAWyF0yuHEHmYTQFAd6WHzp6+IY7JVjE=
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108= github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108=
github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc= github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc=
github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY=
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
...@@ -63,7 +59,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN ...@@ -63,7 +59,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
...@@ -113,8 +108,6 @@ golang.org/x/crypto v0.0.0-20200707235045-ab33eee955e0/go.mod h1:LzIPMQfyMNhhGPh ...@@ -113,8 +108,6 @@ golang.org/x/crypto v0.0.0-20200707235045-ab33eee955e0/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed h1:YoWVYYAfvQ4ddHv3OKmIvX7NCAhFGTj62VP2l2kfBbA=
golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
...@@ -189,5 +182,4 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclp ...@@ -189,5 +182,4 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclp
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
lukechampine.com/blake3 v1.1.6 h1:H3cROdztr7RCfoaTpGZFQsrqvweFLrqS73j7L7cmR5c=
lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
...@@ -14,9 +14,10 @@ import ( ...@@ -14,9 +14,10 @@ import (
"crypto" "crypto"
"crypto/hmac" "crypto/hmac"
"crypto/sha256" "crypto/sha256"
"fmt"
jww "github.com/spf13/jwalterweatherman"
"golang.org/x/crypto/blake2b" "golang.org/x/crypto/blake2b"
"hash" "hash"
"fmt"
) )
// NewCMixHash returns the current cMix hash implementation // NewCMixHash returns the current cMix hash implementation
...@@ -30,7 +31,7 @@ func NewCMixHash() (hash.Hash, error) { ...@@ -30,7 +31,7 @@ func NewCMixHash() (hash.Hash, error) {
func DefaultHash() hash.Hash { func DefaultHash() hash.Hash {
h, err := blake2b.New256(nil) h, err := blake2b.New256(nil)
if err != nil { if err != nil {
panic(fmt.Sprintf("Could not initialize blake2b: %+v", err)) jww.FATAL.Panic(fmt.Sprintf("Could not initialize blake2b: %+v", err))
} }
return h return h
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment