UNPKG
huya-danma-listener
Version:
latest (0.1.4)
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
huya danmu module
github.com/renmu123/biliLive-tools/tree/master/packages/huya-danmu
huya-danma-listener
/
utils.js
12 lines
(9 loc)
•
313 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
import
crypto
from
"node:crypto"
;
export
const
md5
= (
str
) => {
return
crypto.
createHash
(
"md5"
).
update
(str).
digest
(
"hex"
); };
export
function
intToHexColor
(
int
) {
// 将整数转换为十六进制字符串,并确保其长度为 6 位
const
hex = int.
toString
(
16
).
padStart
(
6
,
"0"
);
return
`#
${hex}
`
; }