[v1.4.5] DEBUG

This commit is contained in:
兔子
2024-10-23 15:24:52 +08:00
parent e40685d45d
commit 88d7e77279
2 changed files with 3 additions and 3 deletions

View File

@@ -38,10 +38,10 @@ func (this *HashStruct) Sum32(text any) (result string) {
* @example
* token := utils.Hash.Token("test", 16)
*/
func (this *HashStruct) Token(value string, length int) (result string) {
func (this *HashStruct) Token(value any, length int) (result string) {
// 计算 MD5 哈希值
hash := md5.Sum([]byte(value))
hash := md5.Sum([]byte(cast.ToString(value)))
MD5Hash := hex.EncodeToString(hash[:])
result = MD5Hash[:length]

View File

@@ -185,5 +185,5 @@ func (this *StructStruct) ToStringMap(obj any) (result map[string]any) {
// ToAsciiString - 将结构体转换为ASCII字符串
func (this *StructStruct) ToAsciiString(obj any) (result string) {
return Ascii.ToString(this.ToStringMap(obj))
return Ascii.ToString(this.ToStringMap(obj), true)
}