Skip to content

Add Python parity helpers for JS hash utilities#34

Draft
Copilot wants to merge 8 commits intomainfrom
copilot/add-pythonic-implementation-js-functions
Draft

Add Python parity helpers for JS hash utilities#34
Copilot wants to merge 8 commits intomainfrom
copilot/add-pythonic-implementation-js-functions

Conversation

Copy link

Copilot AI commented Feb 21, 2026

Adds Python equivalents for the shared JS hash helpers to hash strings and objects with deep key sorting for deterministic output and legacy MD5 defaults (with warnings on invalid algorithms).

  • Python hash utilities

    • Implement calculate_hash_from_string and calculate_hash_from_object with deep key sorting, JSON serialization, and legacy MD5 default plus warning-based fallback for unknown algorithms.
    • Expose new helpers via mat3ra.utils package init.
  • Tests

    • Add unit coverage for string/object hashing, custom algorithms, and fallback behavior with warnings.

Example:

from mat3ra.utils import hash as hu

hu.calculate_hash_from_string("abc")          # md5 hex digest
hu.calculate_hash_from_object({"b":1,"a":2})  # deterministic hash (keys sorted)
hu.calculate_hash_from_object({"b":1,"a":2}, "sha256")

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 7 commits February 21, 2026 03:57
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Co-authored-by: timurbazhirov <721112+timurbazhirov@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Pythonic implementation for JS functions in hash.ts Add Python parity helpers for JS hash utilities Feb 21, 2026
Copilot AI requested a review from timurbazhirov February 21, 2026 04:03
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.

2 participants