-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package keys | ||
|
||
// Bytes64 converts byte slice to *[64]byte or panics. | ||
func Bytes64(b []byte) *[64]byte { | ||
if len(b) != 64 { | ||
panic("not 64 bytes") | ||
} | ||
var b64 [64]byte | ||
copy(b64[:], b) | ||
return &b64 | ||
} | ||
|
||
// Bytes32 converts byte slice to *[32]byte or panics. | ||
func Bytes32(b []byte) *[32]byte { | ||
if len(b) != 32 { | ||
panic("not 32 bytes") | ||
} | ||
var b32 [32]byte | ||
copy(b32[:], b) | ||
return &b32 | ||
} | ||
|
||
// Bytes24 converts byte slice to *[24]byte or panics. | ||
func Bytes24(b []byte) *[24]byte { | ||
if len(b) != 24 { | ||
panic("not 24 bytes") | ||
} | ||
var b24 [24]byte | ||
copy(b24[:], b) | ||
return &b24 | ||
} | ||
|
||
// Bytes16 converts byte slice to *[16]byte or panics. | ||
func Bytes16(b []byte) *[16]byte { | ||
if len(b) != 16 { | ||
panic("not 16 bytes") | ||
} | ||
var b16 [16]byte | ||
copy(b16[:], b) | ||
return &b16 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters