Fetch the repository succeeded.
// Package openssl for key certificate management
package openssl
import (
"bytes"
"unsafe"
)
// defines key format enum type.
// 定义密钥格式枚举类型
type keyFormat string
// key format constants.
// 密钥格式常量
const (
PKCS1 keyFormat = "pkcs1"
PKCS8 keyFormat = "pkcs8"
)
var (
RSA = newRsaKeyPair()
)
// converts string to byte slice without a memory allocation.
// 将字符串转换为字节切片
func string2bytes(s string) []byte {
return *(*[]byte)(unsafe.Pointer(
&struct {
string
Cap int
}{s, len(s)},
))
}
// converts byte slice to string without a memory allocation.
// 将字节切片转换为字符串
func bytes2string(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
// split the string by the specified size.
// 按照指定长度分割字符串
func stringSplit(s string, n int) string {
substr, strings := "", ""
runes := bytes.Runes([]byte(s))
l := len(runes)
for i, r := range runes {
substr = substr + string(r)
if (i+1)%n == 0 {
strings = strings + substr + "\n"
substr = ""
} else if (i + 1) == l {
strings = strings + substr + "\n"
}
}
return strings
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。