oid36/oid36.go
2023-08-03 14:44:03 +02:00

22 lines
356 B
Go

package oid36
import (
"encoding/hex"
"code.icod.de/dalu/oid36/internal/base36"
)
func ObjectIDToBase36(oid string) (string, error) {
b, e := hex.DecodeString(oid)
if e != nil {
return "", e
}
s := base36.EncodeBytes(b)
return s, nil
}
func Base36ToObjectID(bid string) string {
b := base36.DecodeToBytes(bid)
return hex.EncodeToString(b)
}