Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hash256 and hash160, update ApplicationEngine #293

Merged
merged 6 commits into from
Jun 17, 2020

Conversation

ShawnYun
Copy link
Contributor

@ProDog
Copy link
Contributor

ProDog commented Jun 12, 2020

I have tested, it's all OK.

Contract:

        public static object Hash160Test(byte[] msg)
        {
            Runtime.Notify(Crypto.RIPEMD160(msg));
            Runtime.Notify(Crypto.HASH160(msg));
            return Crypto.HASH160(msg);
        }

        public static object Hash256Test(byte[] msg)
        {
            Runtime.Notify(Crypto.HASH256(msg));
            Runtime.Notify(Crypto.SHA256(msg));
            return Crypto.HASH256(msg);
        }

Invoke:

neo> invoke 0xa723a2d956ccae9d73c5ef03c300a08a0b6ed796 hash256Test [{"type":"Byte","value":""}]
Invoking script with: '0c0011c00c0b68617368323536546573740c1496d76e0b8aa000c303efc5739daecc56d9a223a741627d5b52'
VM State: HALT
Gas Consumed: 0.0858123
Result Stack: [{"type":"ByteString","value":"Xfbg4nYTWdMKgnUFjimfzAOBU0VF9Vz0PkGYP11MlFY="}]
Relay tx(no|yes): yes
Signed and relayed transaction with hash=0x4c669fa06bfbcae88b4425daae33b88ee9b6b5613d95e284340b4c08ccf44923
neo> invoke 0xa723a2d956ccae9d73c5ef03c300a08a0b6ed796 hash160Test [{"type":"Byte","value":""}]
Invoking script with: '0c0011c00c0b68617368313630546573740c1496d76e0b8aa000c303efc5739daecc56d9a223a741627d5b52'
VM State: HALT
Gas Consumed: 0.0858123
Result Stack: [{"type":"ByteString","value":"tHKiZtC9icE3BqQTLM\u002Bxb3w7n8s="}]
Relay tx(no|yes): yes
Signed and relayed transaction with hash=0x830d40a1f37c899c2d91cf26a52e5f4b61996491f5899eb3355fb5c72613cfd0

Notify:

"notifications": [
            {
                "contract": "0xa723a2d956ccae9d73c5ef03c300a08a0b6ed796",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "ByteString",
                            "value": "Xfbg4nYTWdMKgnUFjimfzAOBU0VF9Vz0PkGYP11MlFY="
                        }
                    ]
                }
            },
            {
                "contract": "0xa723a2d956ccae9d73c5ef03c300a08a0b6ed796",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "ByteString",
                            "value": "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="
                        }
                    ]
                }
            }
        ]

"notifications": [
            {
                "contract": "0xa723a2d956ccae9d73c5ef03c300a08a0b6ed796",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "ByteString",
                            "value": "nBGFpcXp/FRhKAiXfuj1SLIljTE="
                        }
                    ]
                }
            },
            {
                "contract": "0xa723a2d956ccae9d73c5ef03c300a08a0b6ed796",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "ByteString",
                            "value": "tHKiZtC9icE3BqQTLM+xb3w7n8s="
                        }
                    ]
                }
            }
        ]

erikzhang and others added 3 commits June 14, 2020 16:14
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
@shargon shargon merged commit 98c29df into neo-project:master Jun 17, 2020
@ShawnYun ShawnYun deleted the add-hash160 branch June 17, 2020 09:20
ProDog pushed a commit to ProDog/neo-devpack-dotnet that referenced this pull request Jun 22, 2020
* add hash256 and hash160, update ApplicationEngine

* Apply suggestions from code review

Co-authored-by: Luchuan <luchuan@ngd.neo.org>

* Fix UT

* Clean code

Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
Co-authored-by: Erik Zhang <erik@neo.org>
Co-authored-by: Luchuan <luchuan@ngd.neo.org>
Co-authored-by: Shargon <shargon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add RIPEMD160 , hash160, hash256 method
6 participants