I want to split a 32 Byte source: first half in Bytes16 half1; second half in Bytes16 half2. My code works, however only for dynamic array, not with fixed size 16.
pragma solidity ^0.4.8;
contract cut {
function cutSha(bytes32 source) constant returns (bytes, bytes) {
bytes memory half1 = new bytes(16);
bytes memory half2 = new bytes(16);
for (uint j = 0; j < 16; j++) {
half1[j] = source[j];
half2[j] = source[j+16];
}
return (half1, half2);
}
}