-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
👔 up: rename the new sub package encodx to encodes
- Loading branch information
Showing
12 changed files
with
39 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package encodx | ||
package encodes | ||
|
||
import ( | ||
"encoding/base32" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package encodes_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/gookit/goutil/encodes" | ||
"github.com/gookit/goutil/testutil/assert" | ||
) | ||
|
||
func TestBaseDecode(t *testing.T) { | ||
is := assert.New(t) | ||
|
||
is.Eq("GEZGCYTD", encodes.B32Encode("12abc")) | ||
is.Eq("12abc", encodes.B32Decode("GEZGCYTD")) | ||
|
||
// b23 hex | ||
is.Eq("64P62OJ3", encodes.B32Hex.EncodeToString([]byte("12abc"))) | ||
// fmt.Println(time.Now().Format("20060102150405")) | ||
dateStr := "20230908101122" | ||
is.Eq("68O34CPG74O3GC9G64OJ4CG", encodes.B32Hex.EncodeToString([]byte(dateStr))) | ||
|
||
is.Eq("YWJj", encodes.B64Encode("abc")) | ||
is.Eq("abc", encodes.B64Decode("YWJj")) | ||
|
||
is.Eq([]byte("YWJj"), encodes.B64EncodeBytes([]byte("abc"))) | ||
is.Eq([]byte("abc"), encodes.B64DecodeBytes([]byte("YWJj"))) | ||
|
||
is.Eq("MTJhYmM", encodes.B64URL.EncodeToString([]byte("12abc"))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters