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