MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / u32ToU8

Function u32ToU8

Hashes/MD5.js:85–96  ·  view source on GitHub ↗

* Converts Uint32Array to Uint8Array * * @param {Uint32Array} u32Array Uint32Array to convert * @returns {Uint8Array} - Required Uint8Array

(u32Array)

Source from the content-addressed store, hash-verified

83 * @returns {Uint8Array} - Required Uint8Array
84 */
85function u32ToU8(u32Array) {
86 const uint8Array = new Uint8Array(u32Array.length * 4)
87
88 for (let i = 0; i < u32Array.length; i++) {
89 uint8Array[i * 4] = u32Array[i] & 0xff
90 uint8Array[i * 4 + 1] = (u32Array[i] >> 8) & 0xff
91 uint8Array[i * 4 + 2] = (u32Array[i] >> 16) & 0xff
92 uint8Array[i * 4 + 3] = (u32Array[i] >> 24) & 0xff
93 }
94
95 return uint8Array
96}
97
98/**
99 * Adds padding to the end of the given array

Callers 1

MD5Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected