blob: add RefFromString

Change-Id: I1e98874fd43c1570c2e79907dbdbc7e44ca64bf7
This commit is contained in:
Brad Fitzpatrick 2013-10-25 00:22:10 -07:00
parent abdfd02bbb
commit 0dfaad41a7
1 changed files with 6 additions and 0 deletions

View File

@ -298,6 +298,12 @@ func RefFromHash(h hash.Hash) Ref {
return Ref{meta.ctor(h.Sum(nil))}
}
// RefFromString returns a blobref from the given string, for the currently
// recommended hash function
func RefFromString(s string) Ref {
return SHA1FromString(s)
}
// SHA1FromString returns a SHA-1 blobref of the provided string.
func SHA1FromString(s string) Ref {
s1 := sha1.New()