1# Basic Security Capability Development 2 3## What is the maximum number of bytes that can be encrypted at a time in AES GCM mode in HUKS? 4 5Applicable to: OpenHarmony 3.1 Beta 5 (API version 9) 6 7**Solution** 8 9In HUKS, a maximum of 64 bytes can be encrypted at a time in AES GCM mode. 10 11**Example** 12 13``` 14/* Encrypt the key. */ 15await huks.init(srcKeyAlias, encryptOptions).then((data) => { 16 console.info(`test init data: ${JSON.stringify(data)}`); 17 handle = data.handle; 18}).catch((err) => { 19 console.info('test init err information: ' + JSON.stringify(err)); 20}); 21encryptOptions.inData = aesCipherStringToUint8Array(cipherInData.slice (0,64)); // Take 64 bytes. 22await huks.update(handle, encryptOptions).then(async (data) => { 23 console.info(`test update data ${JSON.stringify(data)}`); 24 encryptUpdateResult = Array.from(data.outData); 25}).catch((err) => { 26 console.info('test update err information: ' + err); 27}); 28encryptOptions.inData = aesCipherStringToUint8Array(cipherInData.slice (64,80)); // Remaining data 29``` 30 31## What if garbled characters are returned by **digest()** of **Md** in Crypto framework? 32 33Applicable to: OpenHarmony 3.1 Beta 5 (API version 9) 34 35**Symptom** 36 37In the CryptoFramework, garbled characters are returned by **digest()** of **Md**. 38 39**Solution** 40 41The DataBlob returned by **digest()** is of the Uint8Array type and needs to be converted into a hexadecimal string before being printed. You can use the online MD5 encryption tool to verify the result. 42