Skip to content

Commit 6ae391b

Browse files
committed
Fixes gh-771 Wrong description of incremental encryption
1 parent 7b61611 commit 6ae391b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

doc/1.10/reference/reference_lua/crypto.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,20 @@ Suppose that a digest is done for a string 'A', then a new part 'B' is appended
112112
to the string, then a new digest is required. The new digest could be recomputed
113113
for the whole string 'AB', but it is faster to take what was computed before for
114114
'A' and apply changes based on the new part 'B'. This is called multi-step or
115-
"incremental" digesting, which Tarantool supports for all crypto functions..
115+
"incremental" digesting, which Tarantool supports for all crypto functions.
116116

117117
.. code-block:: lua
118118
119119
crypto = require('crypto')
120120
121121
-- print aes-192 digest of 'AB', with one step, then incrementally
122-
print(crypto.cipher.aes192.cbc.encrypt('AB', 'key'))
123-
c = crypto.cipher.aes192.cbc.encrypt.new()
124-
c:init()
125-
c:update('A', 'key')
126-
c:update('B', 'key')
122+
key = 'key/key/key/key/key/key/'
123+
iv = 'iviviviviviviviv'
124+
print(crypto.cipher.aes192.cbc.encrypt('AB', key, iv))
125+
c = crypto.cipher.aes192.cbc.encrypt.new(key)
126+
c:init(nil, iv)
127+
c:update('A')
128+
c:update('B')
127129
print(c:result())
128130
c:free()
129131

0 commit comments

Comments
 (0)