Created
July 14, 2017 14:46
-
-
Save raucao/818b9c3c9e2658af9f3eaf1dcd4e1044 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.0; | |
library ipfsUtils { | |
function splitHash(bytes source) returns(bytes1, bytes1) { | |
bytes1[2] memory hash = [bytes1(0), bytes1(0)]; | |
assembly { | |
mstore(hash, source) | |
mstore(add(hash, 1), source) | |
} | |
return (hash[0], hash[1]); | |
} | |
} | |
contract Foo { | |
function bar(bytes source) returns(bytes1, bytes1) { | |
return ipfsUtils.splitHash(source); | |
} | |
} |
Author
raucao
commented
Jul 14, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment