Skip to content

implement version-based hashing (SHA1/SHA3-256)#40

Open
alexsyvolap wants to merge 4 commits intoliqpay:masterfrom
alexsyvolap:master
Open

implement version-based hashing (SHA1/SHA3-256)#40
alexsyvolap wants to merge 4 commits intoliqpay:masterfrom
alexsyvolap:master

Conversation

@alexsyvolap
Copy link

@alexsyvolap alexsyvolap commented Feb 11, 2026

Currently, the SDK uses SHA-1 for all signature generations. According to the latest LiqPay API requirements, newer integration versions (specifically version: 7 and above) require the SHA3-256 hashing algorithm.

The current implementation does not support SHA3-256, which prevents using the SDK with the latest API features.

Proposed Solution
Update the signature generation logic to automatically select the hashing algorithm based on the version parameter provided in the request:

  • Version < 7: Keep using sha1 (backward compatibility).
  • Version >= 7: Use sha3-256.

Key Changes

  • Refactor str_to_sign to accept an optional hashing algorithm.
  • Update api and cnb_signature methods to determine the algorithm dynamically based on the version parameter.
  • Add unit tests to verify boundary conditions (v6 vs v7) and ensure state isolation between requests.

Backward Compatibility
This change is fully backward compatible. Existing integrations using API v3 (or any version below 7) will continue to use SHA-1 by default

Image Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant