代码拉取完成,页面将自动刷新
package dongle
type Encrypter struct {
dongle
}
// newEncrypter returns a new Encrypter instance.
func newEncrypter() Encrypter {
return Encrypter{}
}
// FromString encrypts from string.
func (e Encrypter) FromString(s string) Encrypter {
e.src = string2bytes(s)
return e
}
// FromBytes encrypts from byte slice.
func (e Encrypter) FromBytes(b []byte) Encrypter {
e.src = b
return e
}
// String implements Stringer interface for Encrypter struct.
func (e Encrypter) String() string {
return e.ToRawString()
}
// ToRawString outputs as raw string without encoding.
func (e Encrypter) ToRawString() string {
return bytes2string(e.dst)
}
// ToHexString outputs as string with hex encoding.
func (e Encrypter) ToHexString() string {
return Encode.FromBytes(e.dst).ByHex().ToString()
}
// ToBase64String outputs as string with base64 encoding.
func (e Encrypter) ToBase64String() string {
return Encode.FromBytes(e.dst).ByBase64().ToString()
}
// ToRawBytes outputs as raw byte slice without encoding.
func (e Encrypter) ToRawBytes() []byte {
if len(e.dst) == 0 {
return []byte("")
}
return e.dst
}
// ToHexBytes outputs as byte with hex encoding.
func (e Encrypter) ToHexBytes() []byte {
return Encode.FromBytes(e.dst).ByHex().ToBytes()
}
// ToBase64Bytes outputs as byte slice with base64 encoding.
func (e Encrypter) ToBase64Bytes() []byte {
return Encode.FromBytes(e.dst).ByBase64().ToBytes()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。