-
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: refactor to remove need for Utility struct
This also removes all dependence on libolm for the functions that were provided by the Utility struct. The crypto/signatures package should be used for all signature verification operations, and for the occasional situation where a base64-encoded SHA-256 hash is required, the olm.SHA256B64 function should be used. Signed-off-by: Sumner Evans <[email protected]>
- Loading branch information
1 parent
bb9c917
commit dba1c44
Showing
13 changed files
with
122 additions
and
291 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
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package olm | ||
|
||
import ( | ||
"crypto/sha256" | ||
"encoding/base64" | ||
) | ||
|
||
// SHA256B64 calculates the SHA-256 hash of the input and encodes it as base64. | ||
func SHA256B64(input []byte) string { | ||
if len(input) == 0 { | ||
panic(EmptyInput) | ||
} | ||
hash := sha256.Sum256([]byte(input)) | ||
return base64.RawStdEncoding.EncodeToString(hash[:]) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.