![]() |
VOOZH | about |
The crypto.randomFillSync() method is an inbuilt application programming interface of crypto module which is used to return the object passed as buffer argument.
Syntax:
crypto.randomFillSync( buffer, offset, size )
Parameters: This method accept three parameters as mentioned above and described below:
Return Value: It returns Buffer, TypedArray, or DataView type of data.
Below example illustrate the use of crypto.randomFillSync() method in Node.js:
Example 1:
Output:
+~`Ld#%KT&6VF1e K/7gTBXCFISh30dPoE5o K/7gTO7iUG+h30dPoE5o
Here, the last two values are same.
Example 2:
Output:
BQrDFc8= EM4;)N+.qY, o-kp:b:C. 479eb4d9175221
Here, any TypedArray, or DataView instance is passed as buffer.
Reference: https://nodejs.org/api/crypto.html#crypto_crypto_randomfillsync_buffer_offset_size