Node.js ट्यूटोरियल

Node.js होम Node.js परिचय Node.js प्रारंभ करें Node.js मॉड्यूल Node.js HTTP मॉड्यूल Node.js फ़ाइल सिस्टम Node.js URL मॉड्यूल Node.js एनपीएम Node.js घटनाएँ Node.js फ़ाइलें अपलोड करें Node.js ईमेल

Node.js MySQL

MySQL प्रारंभ करें MySQL डेटाबेस बनाएँ MySQL तालिका बनाएँ MySQL सम्मिलित करें MySQL से चुनें MySQL कहाँ MySQL ऑर्डर बाय MySQL हटाएं MySQL ड्रॉप टेबल MySQL अद्यतन MySQL सीमा मायएसक्यूएल जॉइन

Node.js MongoDB

मोंगोडीबी आरंभ करें MongoDB डेटाबेस बनाएँ MongoDB संग्रह बनाएँ मोंगोडीबी डालें मोंगोडीबी खोजें मोंगोडीबी क्वेरी मोंगोडीबी सॉर्ट मोंगोडीबी हटाएं MongoDB ड्रॉप संग्रह मोंगोडीबी अपडेट मोंगोडीबी सीमा मोंगोडीबी शामिल हों

रास्पबेरी पाई

रासपी आरंभ करें रास्पी जीपीआईओ परिचय रासपी ब्लिंकिंग एलईडी रासपी एलईडी और पुशबटन रासपी बहने वाली एल ई डी रासपी वेबसाकेट रासपी आरजीबी एलईडी वेबसाकेट रास्पी अवयव

Node.js संदर्भ

अंतर्निहित मॉड्यूल

Node.js क्रिप्टो मॉड्यूल

अंतर्निहित मॉड्यूल


उदाहरण

टेक्स्ट 'एबीसी' एन्क्रिप्ट करें

var crypto = require('crypto');

var mykey = crypto.createCipher('aes-128-cbc', 'mypassword');
var mystr = mykey.update('abc', 'utf8', 'hex')
mystr += mykey.final('hex');

console.log(mystr); //34feb914c099df25794bf9ccb85bea72

उदाहरण

'abc' पर वापस डिक्रिप्ट करें

var crypto = require('crypto');

var mykey = crypto.createDecipher('aes-128-cbc', 'mypassword');
var mystr = mykey.update('34feb914c099df25794bf9ccb85bea72', 'hex', 'utf8')
mystr += mykey.final('utf8');

console.log(mystr); //abc

परिभाषा और उपयोग

क्रिप्टो मॉड्यूल एन्क्रिप्टेड डेटा को संभालने का एक तरीका प्रदान करता है।


वाक्य - विन्यास

आपके आवेदन में क्रिप्टो मॉड्यूल को शामिल करने के लिए सिंटैक्स:

var crypto = require('crypto');

क्रिप्टो गुण और तरीके

Method Description
constants Returns an object containing Crypto Constants
fips Checks if a FIPS crypto provider is in use
createCipher() Creates a Cipher object using the specific algorithm and password
createCipheriv() Creates a Cipher object using the specific algorithm, password and initialization vector
createDecipher() Creates a Decipher object using the specific algorithm and password
createDecipheriv() Creates a Decipher object using the specific algorithm, password and initialization vector
createDiffieHellman() Creates a DiffieHellman key exchange object
createECDH() Creates an Elliptic Curve Diffie Hellmann key exchange object
createHash() Creates a Hash object using the specified algorithm
createHmac() Creates a Hmac object using the specified algorithm and key
createSign() Creates a Sign object using the specified algorithm and key
createVerify() Creates a Verify object using the specified algorithm
getCiphers Returns an array of supported cipher algorithms
getCurves() Returns an array of supported elliptic curves
getDiffieHellman() Returns a predefined Diffie Hellman key exchange object
getHashes() Returns an array of supported hash algorithms
pbkdf2() Creates a Password Based Key Derivation Function 2 implementation
pbkdf2Sync() Creates a synchronous Password Based Key Derivation Function 2 implementation
privateDecrypt() Decrypts data using a private key
timingSafeEqual() Compare two Buffers and returns true is they are equal, otherwise false
privateEncrypt() Encrypts data using a private key
publicDecrypt() Decrypts data using a public key
publicEncrypt() Encrypts data using a public key
randomBytes() Creates random data
setEngine() Sets the engine for some or all OpenSSL function

अंतर्निहित मॉड्यूल