aboutsummaryrefslogtreecommitdiff
path: root/spdx/common/checksum.go
diff options
context:
space:
mode:
authorBrandon Lum <lumjjb@gmail.com>2022-06-06 10:42:27 -0400
committerBrandon Lum <lumjjb@gmail.com>2022-06-06 10:42:27 -0400
commit41d2272711255f5a25e16e3507ec3318bc550189 (patch)
treeace557ed0ffe3fab18f721744448de5936f23976 /spdx/common/checksum.go
parenta532726dbb7a38d0f714075e9a1f1df4cae60230 (diff)
downloadspdx-tools-41d2272711255f5a25e16e3507ec3318bc550189.tar.gz
convert spdx structs to versioned pkgs
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
Diffstat (limited to 'spdx/common/checksum.go')
-rw-r--r--spdx/common/checksum.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/spdx/common/checksum.go b/spdx/common/checksum.go
new file mode 100644
index 0000000..02a57ff
--- /dev/null
+++ b/spdx/common/checksum.go
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+
+package common
+
+// ChecksumAlgorithm represents the algorithm used to generate the file checksum in the Checksum struct.
+type ChecksumAlgorithm string
+
+// The checksum algorithms mentioned in the spdxv2.2.0 https://spdx.github.io/spdx-spec/4-file-information/#44-file-checksum
+const (
+ SHA224 ChecksumAlgorithm = "SHA224"
+ SHA1 ChecksumAlgorithm = "SHA1"
+ SHA256 ChecksumAlgorithm = "SHA256"
+ SHA384 ChecksumAlgorithm = "SHA384"
+ SHA512 ChecksumAlgorithm = "SHA512"
+ MD2 ChecksumAlgorithm = "MD2"
+ MD4 ChecksumAlgorithm = "MD4"
+ MD5 ChecksumAlgorithm = "MD5"
+ MD6 ChecksumAlgorithm = "MD6"
+)
+
+// Checksum provides a unique identifier to match analysis information on each specific file in a package.
+// The Algorithm field describes the ChecksumAlgorithm used and the Value represents the file checksum
+type Checksum struct {
+ Algorithm ChecksumAlgorithm `json:"algorithm"`
+ Value string `json:"checksumValue"`
+}