.. index:: single: hash_common_64
.. _hash_common_64/0:

.. rst-class:: right

**object**

``hash_common_64``
==================

Auxiliary predicates for the hashes library 64-bit algorithms.

| **Availability:** 
|    ``logtalk_load(hashes(loader))``

| **Author:** Paulo Moura
| **Version:** 1:1:0
| **Date:** 2026-06-01

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Uses:**
|    :ref:`list <list/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: word64_hex/2
.. _hash_common_64/0::word64_hex/2:

``word64_hex/2``
^^^^^^^^^^^^^^^^

Converts a 64-bit word into a 16-digit lowercase hexadecimal atom.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``word64_hex(Word,Hex)``
| **Mode and number of proofs:**
|    ``word64_hex(+integer,-atom)`` - ``one``


------------

.. index:: mask64/1
.. _hash_common_64/0::mask64/1:

``mask64/1``
^^^^^^^^^^^^

Returns the 64-bit mask value.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``mask64(Mask)``
| **Mode and number of proofs:**
|    ``mask64(-integer)`` - ``one``


------------

.. index:: add64/3
.. _hash_common_64/0::add64/3:

``add64/3``
^^^^^^^^^^^

Adds two integers modulo 2^64.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``add64(A,B,Sum)``
| **Mode and number of proofs:**
|    ``add64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: mul64/3
.. _hash_common_64/0::mul64/3:

``mul64/3``
^^^^^^^^^^^

Multiplies two integers modulo 2^64.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``mul64(A,B,Product)``
| **Mode and number of proofs:**
|    ``mul64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: rol64/3
.. _hash_common_64/0::rol64/3:

``rol64/3``
^^^^^^^^^^^

Rotates a 64-bit word left by the given number of bits.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``rol64(Value,Shift,Rotated)``
| **Mode and number of proofs:**
|    ``rol64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: xor64/3
.. _hash_common_64/0::xor64/3:

``xor64/3``
^^^^^^^^^^^

Computes the bitwise exclusive-or of two integers modulo 2^64.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``xor64(A,B,Xor)``
| **Mode and number of proofs:**
|    ``xor64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: or64/3
.. _hash_common_64/0::or64/3:

``or64/3``
^^^^^^^^^^

Computes the bitwise disjunction of two integers modulo 2^64.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``or64(A,B,Or)``
| **Mode and number of proofs:**
|    ``or64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: and64/3
.. _hash_common_64/0::and64/3:

``and64/3``
^^^^^^^^^^^

Computes the bitwise conjunction of two integers modulo 2^64.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``and64(A,B,And)``
| **Mode and number of proofs:**
|    ``and64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: not64/2
.. _hash_common_64/0::not64/2:

``not64/2``
^^^^^^^^^^^

Computes the bitwise complement of an integer modulo 2^64.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``not64(Value,Complement)``
| **Mode and number of proofs:**
|    ``not64(+integer,-integer)`` - ``one``


------------

.. index:: shl64/3
.. _hash_common_64/0::shl64/3:

``shl64/3``
^^^^^^^^^^^

Shifts a 64-bit word left by the given number of bits and masks the result.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``shl64(Value,Shift,Shifted)``
| **Mode and number of proofs:**
|    ``shl64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: shr64/3
.. _hash_common_64/0::shr64/3:

``shr64/3``
^^^^^^^^^^^

Shifts a 64-bit word right by the given number of bits after masking the input.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``shr64(Value,Shift,Shifted)``
| **Mode and number of proofs:**
|    ``shr64(+integer,+integer,-integer)`` - ``one``


------------

.. index:: integer_to_big_endian_bytes64/3
.. _hash_common_64/0::integer_to_big_endian_bytes64/3:

``integer_to_big_endian_bytes64/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Encodes a 64-bit word into eight bytes in big-endian order.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``integer_to_big_endian_bytes64(Integer,Bytes,Tail)``
| **Mode and number of proofs:**
|    ``integer_to_big_endian_bytes64(+integer,-list(integer),-variable)`` - ``one``


------------

.. index:: integer_to_big_endian_bytes64/2
.. _hash_common_64/0::integer_to_big_endian_bytes64/2:

``integer_to_big_endian_bytes64/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Encodes a 64-bit word into eight bytes in big-endian order.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``integer_to_big_endian_bytes64(Integer,Bytes)``
| **Mode and number of proofs:**
|    ``integer_to_big_endian_bytes64(+integer,-list(integer))`` - ``one``


------------

.. index:: pad_md_tail/3
.. _hash_common_64/0::pad_md_tail/3:

``pad_md_tail/3``
^^^^^^^^^^^^^^^^^

Pads the final, less-than-one-block tail of a message using SHA-512-style MD padding (128-byte blocks, a big-endian 128-bit length field) given the total message length in bytes. For use when the message has already been consumed block by block during segmented/incremental hashing, so that only the unconsumed tail, and not the whole message, needs to be available.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``pad_md_tail(TailBytes,TotalLength,PaddedBytes)``
| **Mode and number of proofs:**
|    ``pad_md_tail(+list(integer),+integer,-list(integer))`` - ``one``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

