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

json-canon-fuzz

v0.1.0

Published

Fuzzer to test whether your JSON serialization is canonical.

Downloads

8

Readme

json-canon-fuzz

Fuzzer to test whether your JSON serialization is canonical.

Install

npm install -g json-canon-fuzz

Usage

Usage
  $ json-canon-fuzz {type} {count} {path}

Arguments
  - type: either `json` or `numbers`
  - count: how many lines to generate (default: Infinity)
  - path: where to output the generated lines (default: stdout)

Examples
  $ json-canon-fuzz json 100000

Numbers

The test output consists of lines

hex-ieee,expected\n

where hex-ieee holds 1-16 ASCII hexadecimal characters representing an IEEE-754 double precision value while expected holds the expected serialized value.

Each line is terminated by a single new-line character.

Sample lines:

4340000000000001,9007199254740994
4340000000000002,9007199254740996
444b1ae4d6e2ef50,1e+21
3eb0c6f7a0b5ed8d,0.000001
3eb0c6f7a0b5ed8c,9.999999999999997e-7
8000000000000000,0
0,0

The generation is deterministic. After generating a file, the program will output the hash of the file.

The following table records the expected hashes:

| SHA-256 checksum | Number of lines | Size in bytes | | ---------------------------------------------------------------- | --------------- | ------------- | | be18b62b6f69cdab33a7e0dae0d9cfa869fda80ddc712221570f9f40a5878687 | 1000 | 37967 | | b9f7a8e75ef22a835685a52ccba7f7d6bdc99e34b010992cbc5864cd12be6892 | 10000 | 399022 | | 22776e6d4b49fa294a0d0f349268e5c28808fe7e0cb2bcbe28f63894e494d4c7 | 100000 | 4031728 | | 49415fee2c56c77864931bd3624faad425c3c577d6d74e89a83bc725506dad16 | 1000000 | 40357417 | | b9f8a44a91d46813b21b9602e72f112613c91408db0b8341fb94603d9db135e0 | 10000000 | 403630048 | | 0f7dda6b0837dde083c5d6b896f7d62340c8a2415b0c7121d83145e08a755272 | 100000000 | 4036326174 |

JSON

The test output consists of lines

json\n

where json is a valid JSON object serialized according to RFC8785: JSON Canonicalization Scheme (JCS).

Each line is terminated by a single new-line character.

Sample lines:

false
{"J���\toR�B\u001d":false,"]E�\u001e\u001d\u0019":4206124647,"�":"�Ĉ/�\u000e\b������5ɵ3\u0014","�\u0001Ƨ�\u0002ŵ":4.633184220509346,"�h\u0002\u000b�u��\\�":"�7� ���xB�K���!\u0019�ujҡ\u0019�Nx�D<��m\u0010*�\u0016p�\u001b�^ aLNt����P�","��X|Av[^E":-1306679260}
0.7290520820698927
null
"����Z\u0000��/�Bc_+�m�\u0002�\u0006�u�������RṚ�H\u000f�K\u0019��8\"�^ռI�\u0011ו\u001c�:D��n\u0005�s�m\u0013H��\t\b� H̑�\u001a}����\u0005 y&BO"
{}

The generation is not deterministic.

References