aboutsummaryrefslogtreecommitdiff
path: root/object/id/algorithm_parse.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-04-02 07:34:09 +0000
committerGravatar Runxi Yu2026-04-02 07:34:09 +0000
commitf805d0ba947e0aa39ca8040cf71b7e0fad3de919 (patch)
treeb683eb327f94a02a17c406631089fa1f8bc28b9a /object/id/algorithm_parse.go
parentobject/id: Add algorithm (diff)
signatureNo signature
object/id: Add algorithm stuff
Diffstat (limited to 'object/id/algorithm_parse.go')
-rw-r--r--object/id/algorithm_parse.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/object/id/algorithm_parse.go b/object/id/algorithm_parse.go
new file mode 100644
index 00000000..7349288f
--- /dev/null
+++ b/object/id/algorithm_parse.go
@@ -0,0 +1,8 @@
+package id
+
+// ParseAlgorithm parses a canonical algorithm name (e.g. "sha1", "sha256").
+func ParseAlgorithm(s string) (Algorithm, bool) {
+ algo, ok := algorithmByName[s]
+
+ return algo, ok
+}