Skip to main content
1 of 2

Here is a way to extract bytes32 out of a bytes array:

function bytesToBytes32(bytes b, uint offset) private pure returns (bytes32) {
    bytes32 out;

    for (uint i = 0; i < 32; i++) {
        out |= ((b[offset + i] & 0xFF) << (i * 8));
    }
    return out;
}