release: 1.8.0

This commit is contained in:
手瓜一十雪
2024-08-06 09:13:03 +08:00
parent 87c3863f88
commit 126f530ead
6 changed files with 9 additions and 7 deletions

View File

@@ -99,8 +99,10 @@ class MessageUniqueWrapper {
}
createMsg(peer: Peer, msgId: string): number | undefined {
const key = `${msgId}|${peer.chatType}|${peer.peerUid}`;
const hash = crypto.createHash('md5').update(key);
const shortId = hash.digest().readUInt32BE(0);
const hash = crypto.createHash('md5').update(key).digest();
//设置第一个bit为0 保证shortId为正数
hash[0] &= 0x7f;
const shortId = hash.readInt32BE(0);
//减少性能损耗
// const isExist = this.msgIdMap.getKey(shortId);
// if (isExist && isExist === msgId) {