Commit 102a4e1a authored by tavit ohanian's avatar tavit ohanian

dms3 initial variant

parent ffbf0ba0
......@@ -2,13 +2,13 @@ package util
import "time"
// TimeFormatIpfs is the format ipfs uses to represent time in string form.
var TimeFormatIpfs = time.RFC3339Nano
// TimeFormatDms3 is the format dms3 uses to represent time in string form.
var TimeFormatDms3 = time.RFC3339Nano
// ParseRFC3339 parses an RFC3339Nano-formatted time stamp and
// returns the UTC time.
func ParseRFC3339(s string) (time.Time, error) {
t, err := time.Parse(TimeFormatIpfs, s)
t, err := time.Parse(TimeFormatDms3, s)
if err != nil {
return time.Time{}, err
}
......@@ -18,5 +18,5 @@ func ParseRFC3339(s string) (time.Time, error) {
// FormatRFC3339 returns the string representation of the
// UTC value of the given time in RFC3339Nano format.
func FormatRFC3339(t time.Time) string {
return t.UTC().Format(TimeFormatIpfs)
return t.UTC().Format(TimeFormatDms3)
}
// Package util implements various utility functions used within ipfs
// Package util implements various utility functions used within dms3
// that do not currently have a better place to live.
package util
......@@ -16,8 +16,8 @@ import (
mh "github.com/multiformats/go-multihash"
)
// DefaultIpfsHash is the current default hash function used by IPFS.
const DefaultIpfsHash = mh.SHA2_256
// DefaultDms3Hash is the current default hash function used by DMS3.
const DefaultDms3Hash = mh.SHA2_256
// Debug is a global flag for debugging.
var Debug bool
......@@ -126,9 +126,9 @@ func RPartition(subject string, sep string) (string, string, string) {
return subject, "", ""
}
// Hash is the global IPFS hash function. uses multihash SHA2_256, 256 bits
// Hash is the global DMS3 hash function. uses multihash SHA2_256, 256 bits
func Hash(data []byte) mh.Multihash {
h, err := mh.Sum(data, DefaultIpfsHash, -1)
h, err := mh.Sum(data, DefaultDms3Hash, -1)
if err != nil {
// this error can be safely ignored (panic) because multihash only fails
// from the selection of hash function. If the fn + length are valid, it
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment