npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qqtea

v0.1.3

Published

qq tea encription algorithm in pure javascript.

Downloads

6

Readme

QQ 填充算法和Tea加解密的JavaScript实现

Example:


/*
QQ PC Client UDP 数据包样本:
02 35 47 08 25 05 87 00 00 00 00 03 00 00 00 01 01 01 00 00 67 22 00 00 00 00 E7 15 BA 2E D5 49 63 A5 5D 29 9E A7 82 7B A7 CD E8 F3 03 39 AB 88 A0 8A 48 42 62 7A 9F BB 80 6F 47 54 82 57 32 4F 38 71 5A 17 3C A4 35 BD FF AD 6C 10 11 06 13 A7 A2 85 AA E0 26 20 D9 78 B8 FE D5 B7 A7 B4 64 FD BE 7E B7 8D FF 8E 9C 8D D5 B3 95 AE 74 68 8F 56 F5 0A 72 68 B8 68 E2 AB CC 77 FA 1C 2A A2 11 91 6A CD 82 DA 02 89 54 46 E2 38 C4 E5 D0 C5 9C 5C 41 1B 03
*/

var tea = require('qqtea');

key = tea.hex2bin('E7 15 BA 2E D5 49 63 A5 5D 29 9E A7 82 7B A7 CD');

data = tea.hex2bin('E8 F3 03 39 AB 88 A0 8A 48 42 62 7A 9F BB 80 6F 47 54 82 57 32 4F 38 71 5A 17 3C A4 35 BD FF AD 6C 10 11 06 13 A7 A2 85 AA E0 26 20 D9 78 B8 FE D5 B7 A7 B4 64 FD BE 7E B7 8D FF 8E 9C 8D D5 B3 95 AE 74 68 8F 56 F5 0A 72 68 B8 68 E2 AB CC 77 FA 1C 2A A2 11 91 6A CD 82 DA 02 89 54 46 E2 38 C4 E5 D0 C5 9C 5C 41 1B');

result = tea.decrypt(key, data);//解密

console.log(tea.bin2hex(result));//输出结果(hex)

data = tea.encrypt(key, result);//加密

console.log(tea.bin2hex(data));//输出加密后的结果(hex), 因为QQ的Tea算法中对前8个字节采用随机填充的机制,所以每次加密后的结果都是一样的

result = tea.decrypt(key, data);//再次进行解密

console.log(tea.bin2hex(result));//输出解密后的结果(hex)


/*
    与腾讯QQ服务器交互的样本.
	功能: 根据Email账号获取对应的QQ号码.
*/

var email = '[email protected]';//要查询的Email

data = tea.hex2bin('02') + String.fromCharCode(email.length) + email;//构造请求包

data = tea.encrypt(key, data);//使用KEY进行加密

var message = new Buffer(tea.hex2bin('02122100b20D1B00000000') + key + data + '\x03', 'binary');//构造一个Buffer(因为dgram只能发送Buffer类型的数据)

require('dgram').createSocket('udp4').on('message', function (message, remote) {//receive message
	var data = message.toString('binary', 7, message.length - 1);//得到数据体(忽略包头和包尾)

	data = tea.decrypt(key, data);//使用之前的加密KEY进行解密

	message = new Buffer(data, 'binary');

	console.log('QQ Number:\t' + parseInt(message.toString('hex', 2, message.length - (message.length - 6)), 16));//输出对应的QQ号码

	this.close();
}).send(message, 0, message.length, 8000, 'sz3.tencent.com');//向腾讯QQ的服务器发送数据包

JavaScript 算法根据 QQ填充算法和TEA 加解密的python实现 改写而成.