cue/pkg/crypto: make return types bytes, instead of list
Note that the generated builtins indicate a bytes
or string return type. This is fine, as the actual
conversion will restrict it to bytes.
Closes #92
Change-Id: Ib8a92d9feebf6f298dc0c35d2831f80e5d7a76ca
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/3048
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/pkg/crypto/sha256/sha256.go b/pkg/crypto/sha256/sha256.go
index 85088ca..3320a06 100644
--- a/pkg/crypto/sha256/sha256.go
+++ b/pkg/crypto/sha256/sha256.go
@@ -16,8 +16,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:generate qgo extract crypto/sha256
-
package sha256
import "crypto/sha256"
@@ -32,11 +30,13 @@
const BlockSize = 64
// Sum256 returns the SHA256 checksum of the data.
-func Sum256(data []byte) [Size]byte {
- return sha256.Sum256(data)
+func Sum256(data []byte) []byte {
+ a := sha256.Sum256(data)
+ return a[:]
}
// Sum224 returns the SHA224 checksum of the data.
-func Sum224(data []byte) (sum224 [Size224]byte) {
- return sha256.Sum224(data)
+func Sum224(data []byte) (sum224 []byte) {
+ a := sha256.Sum224(data)
+ return a[:]
}