Skip to content
This repository
Browse code

Doc improvements and change argument name.

Fixes #1318.
  • Loading branch information...
commit d32971a8cbc0ac6ab7a044e25ff400587bc1294f 1 parent deb100f
Koichi Kobayashi authored July 24, 2011
26  doc/api/crypto.markdown
Source Rendered
@@ -76,12 +76,23 @@ Calculates the digest of all of the passed data to the hmac.
76 76
 The `encoding` can be `'hex'`, `'binary'` or `'base64'`.
77 77
 
78 78
 
79  
-### crypto.createCipher(algorithm, key)
  79
+### crypto.createCipher(algorithm, password)
80 80
 
81  
-Creates and returns a cipher object, with the given algorithm and key.
  81
+Creates and returns a cipher object, with the given algorithm and password.
82 82
 
83 83
 `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc.
84  
-On recent releases, `openssl list-cipher-algorithms` will display the available cipher algorithms.
  84
+On recent releases, `openssl list-cipher-algorithms` will display the
  85
+available cipher algorithms.
  86
+`password` is used to derive key and IV, which must be `'binary'` encoded
  87
+string (See the [Buffers](buffers.html) for more information).
  88
+
  89
+### crypto.createCipheriv(algorithm, key, iv)
  90
+
  91
+Creates and returns a cipher object, with the given algorithm, key and iv.
  92
+
  93
+`algorithm` is the same as the `createCipher()`. `key` is a raw key used in
  94
+algorithm. `iv` is an Initialization vector. `key` and `iv` must be `'binary'`
  95
+encoded string (See the [Buffers](buffers.html) for more information).
85 96
 
86 97
 ### cipher.update(data, input_encoding='binary', output_encoding='binary')
87 98
 
@@ -95,10 +106,15 @@ Returns the enciphered contents, and can be called many times with new data as i
95 106
 
96 107
 Returns any remaining enciphered contents, with `output_encoding` being one of: `'binary'`, `'base64'` or `'hex'`.
97 108
 
98  
-### crypto.createDecipher(algorithm, key)
  109
+### crypto.createDecipher(algorithm, password)
99 110
 
100 111
 Creates and returns a decipher object, with the given algorithm and key.
101  
-This is the mirror of the cipher object above.
  112
+This is the mirror of the [createCipher()](#crypto.createCipher) above.
  113
+
  114
+### crypto.createDecipheriv(algorithm, key, iv)
  115
+
  116
+Creates and returns a decipher object, with the given algorithm, key and iv.
  117
+This is the mirror of the [createCipheriv()](#crypto.createCipheriv) above.
102 118
 
103 119
 ### decipher.update(data, input_encoding='binary', output_encoding='binary')
104 120
 
8  lib/crypto.js
@@ -110,8 +110,8 @@ exports.createHmac = function(hmac, key) {
110 110
 
111 111
 
112 112
 exports.Cipher = Cipher;
113  
-exports.createCipher = function(cipher, key) {
114  
-  return (new Cipher).init(cipher, key);
  113
+exports.createCipher = function(cipher, password) {
  114
+  return (new Cipher).init(cipher, password);
115 115
 };
116 116
 
117 117
 
@@ -121,8 +121,8 @@ exports.createCipheriv = function(cipher, key, iv) {
121 121
 
122 122
 
123 123
 exports.Decipher = Decipher;
124  
-exports.createDecipher = function(cipher, key) {
125  
-  return (new Decipher).init(cipher, key);
  124
+exports.createDecipher = function(cipher, password) {
  125
+  return (new Decipher).init(cipher, password);
126 126
 };
127 127
 
128 128
 

0 notes on commit d32971a

Please sign in to comment.
Something went wrong with that request. Please try again.