Skip to main content

RCP - Random Checksum Protocol

RCP's main use case is providing a checksum to validate requests between HTTP Servers. Therefore each server has a shared secret to which all the others have to have access to.

How to implement

  • Put all your data from your POST or GET Request in a dictionary
  • Sort the dictionary alphanumerical by its keys.
  • Concat its values to the respective key and join them: key1value1key2value2...
    • Note: When using non str values:
      • bool is represented as "true" or "false"
  • Append the shared secret of your target
  • Append current utc timestamp (unix epoch - just seconds)
  • Optional: Add a salt (this may be the method's endpoint): saltkey1value1...
  • Hash with SHA512
  • Represent the hash as hex string (lowercase)
  • The endpoint you're trying to reach should have the position stated, where the checksum should be put. This may be as a key in a POST request, or via Authentication Header.

Watch out As this protocol heavily depends on retrieving the correct time, it may be required to enable NTP on your servers.

How to use the reference implementation

Get checksum

from rc_protocol import get_checksum

SHARED_SECRET = "s3cr3t_p@ssw0rd"

my_dict = {
    "key1": "value1",
    "key2": "value2"
}

checksum = get_checksum(my_dict, SHARED_SECRET)

Validate checksum

from rc_protocol import validate_checksum

SHARED_SECRET = "s3cr3t_p@ssw0rd"

my_dict = {
    "key1": "value1",
    "key2": "value2",
}
checksum = "d0690e3c924e18bad866e2867698be75f64bdc6e809b76ffedb5c5095c9fbe15d36636b2df1fc47d2a3f348aea272ffc2fed4dc8ee08e0d13631ef646e1648c4"

if validate_checksum(my_dict, checksum, SHARED_SECRET):
    do_random_things()
else:
    print("You shall not pass.")

Implementations

Metadata

Release files for rc-protocol 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rc-protocol 1.0.0
File Size Uploaded Provenance
rc-protocol-1.0.0.tar.gz 10.0 kB Without provenance Details

Release files / rc-protocol-1.0.0.tar.gz

Download URL rc-protocol-1.0.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
202da7abe4e3dfb7a8281acc7dc28d1c7b777dc35cd6ebf4b827d4db1a145883
BLAKE2b-256 checksum
How to use checksums
6eb7ac032bf25daf73bc212c6c9d6ab55e6e3b6ef69b30ad07b2ff71be1e8803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.10.2

Security for rc-protocol 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page