Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doc comments #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions hashids.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ func (h *HashID) Decode(hash string) []int {
return result
}

// Decode unhashes the string passed to an array of int.
// DecodeWithError unhashes the string passed to an array of int.
// It is symmetric with Encode if the Alphabet and Salt are the same ones which were used to hash.
// MinLength has no effect on Decode.
// Does a sanity check with Encode so settings need to be the same!
func (h *HashID) DecodeWithError(hash string) ([]int, error) {
result64, err := h.DecodeInt64WithError(hash)
if err != nil {
Expand All @@ -287,9 +287,9 @@ func (h *HashID) DecodeInt64(hash string) []int64 {
return result
}

// DecodeInt64 unhashes the string passed to an array of int64.
// DecodeInt64WithError unhashes the string passed to an array of int64.
// It is symmetric with EncodeInt64 if the Alphabet and Salt are the same ones which were used to hash.
// MinLength has no effect on DecodeInt64.
// Does a sanity check with Encode so settings need to be the same!
func (h *HashID) DecodeInt64WithError(hash string) ([]int64, error) {
hashes := splitRunes([]rune(hash), h.guards)
hashIndex := 0
Expand Down Expand Up @@ -331,7 +331,7 @@ func (h *HashID) DecodeInt64WithError(hash string) ([]int64, error) {

// DecodeHex unhashes the string passed to a hexadecimal string.
// It is symmetric with EncodeHex if the Alphabet and Salt are the same ones which were used to hash.
//
// Does a sanity check with Encode so settings need to be the same!
// Each hex nibble is decoded from an integer in range [16, 31].
func (h *HashID) DecodeHex(hash string) (string, error) {
numbers, err := h.DecodeInt64WithError(hash)
Expand Down