]> Repositorios git - scryer-prolog.git/commitdiff
remove several mentions of list of bytes in predicate descriptions
authorMarkus Triska <[email protected]>
Wed, 20 May 2020 22:07:28 +0000 (00:07 +0200)
committerMarkus Triska <[email protected]>
Wed, 20 May 2020 22:07:42 +0000 (00:07 +0200)
This is to focus more on the intended core representation of text: In
Prolog, text is ideally represented as a list of characters, and this
is what we want to encourage, especially given Scryer's compact
representation for strings.

For the time being, library(crypto) still also supports lists of bytes in
several predicates. This will likely be removed at some point in the
future. Please use lists of characters to make your code future-proof.

src/prolog/lib/crypto.pl

index 9fb5e2163e0ae9cc4137c1bad9a1c874cf45f07c..d4ebf2e5d30fa28849ca78098befd0251f553523 100644 (file)
@@ -155,9 +155,8 @@ crypto_random_byte(B) :- '$crypto_random_byte'(B).
 
    crypto_data_hash(+Data, -Hash, +Options)
 
-   Where Data is a list of bytes (integers between 0 and 255) or
-   characters, and Hash is the computed hash as a list of hexadecimal
-   characters.
+   Where Data is a list of characters, and Hash is the computed hash
+   as a list of hexadecimal characters.
 
    Options is a list of:
 
@@ -231,7 +230,7 @@ hash_algorithm(blake2b512).
    crypto_data_hkdf(+Data, +Length, -Bytes, +Options) is det.
 
    Concentrate possibly dispersed entropy of Data and then expand it
-   to the desired length. Data is a list of bytes or characters.
+   to the desired length. Data is a list of characters.
 
    Bytes is unified with a list of bytes of length Length, and is
    suitable as input keying material and initialization vectors to
@@ -245,7 +244,7 @@ hash_algorithm(blake2b512).
        cryptographically secure algorithm by default.
      - info(+Info)
        Optional context and application specific information,
-       specified as a list of bytes or characters. The default is [].
+       specified as a list of characters. The default is [].
      - salt(+List)
        Optionally, a list of bytes that are used as salt. The
        default is all zeroes.
@@ -480,8 +479,8 @@ bytes_base64_([A,B,C|Ls]) --> [W,X,Y,Z],
    Algorithm, key Key, and initialization vector (or nonce) IV, to
    give CipherText.
 
-   PlainText must be a list of bytes or characters, Key and IV must be
-   lists of bytes, and CipherText is created as a list of characters.
+   PlainText must be a list of characters, Key and IV must be lists of
+   bytes, and CipherText is created as a list of characters.
 
    Keys and IVs can be chosen at random (using for example
    crypto_n_random_bytes/2) or derived from input keying material (IKM)
@@ -579,9 +578,9 @@ crypto_data_encrypt(PlainText0, Algorithm, Key, IV, CipherText, Options) :-
 
    Decrypt the given CipherText, using the symmetric algorithm
    Algorithm, key Key, and initialization vector IV, to give
-   PlainText. CipherText must be a list of bytes or characters, and
-   Key and IV must be lists of bytes. PlainText is created as a list
-   of characters.
+   PlainText. CipherText must be a list of characters, and Key and IV
+   must be lists of bytes. PlainText is created as a list of
+   characters.
 
    Currently, the only supported algorithm is 'chacha20-poly1305',
    a very secure, fast and versatile authenticated encryption method.