{"id":47127955,"url":"https://github.com/zhaohaijun/blockchain-crypto","last_synced_at":"2026-03-12T19:58:38.933Z","repository":{"id":57712323,"uuid":"153257607","full_name":"zhaohaijun/blockchain-crypto","owner":"zhaohaijun","description":"Crypto for BlockChain","archived":false,"fork":false,"pushed_at":"2019-03-19T07:47:37.000Z","size":78,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-28T09:39:27.704Z","etag":null,"topics":["blockchain","cryptography","sm2","vrf"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhaohaijun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-16T09:17:35.000Z","updated_at":"2020-04-03T14:17:11.000Z","dependencies_parsed_at":"2022-09-26T21:30:35.983Z","dependency_job_id":null,"html_url":"https://github.com/zhaohaijun/blockchain-crypto","commit_stats":null,"previous_names":["zhaohaijun/crypto"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zhaohaijun/blockchain-crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaohaijun%2Fblockchain-crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaohaijun%2Fblockchain-crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaohaijun%2Fblockchain-crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaohaijun%2Fblockchain-crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhaohaijun","download_url":"https://codeload.github.com/zhaohaijun/blockchain-crypto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhaohaijun%2Fblockchain-crypto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30441854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","cryptography","sm2","vrf"],"created_at":"2026-03-12T19:58:38.139Z","updated_at":"2026-03-12T19:58:38.903Z","avatar_url":"https://github.com/zhaohaijun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlockChain Crypto\n\nCryptography Library for BlockChain NetWork\n# Usage\n## Key pair\nGenerate a key pair:\n```go\nimport \"github.com/zhaohaijun/blockchain-crypto/keypair\"\n// Generate key pair\nprivate,public,err:=keypair.GenerateKeyPair(keypair.PK_ECDSA,keypair.P256)\n```\nThe first arguments indicates the key type used for specific algorithm.\nAvailable key types:\n\n    PK_ECDSA\n    PK_SM2\n    PK_EDDSA\nThe second argument differs from the key types:\n* as for to ECDSA,it indicates the curve which could be one of:\n\n   `P224,P256,P384,P521`\n* as for SM2,it indicates the curve similar to ECDSA but should be `SM2P256V1`.\n \n* as for EdDSA,it should be `ED25519`\n\nTo serialize/deserialize the public key:\n```\n// Serialize public key\npublic ,err :=keypair.DeserializePublicKey(buf)\n```\n##Signature\nTo generate a signature for some message, a private key should be provided as\nwell as a specified signature scheme. Notice that the signature scheme should\nmatch the private key.\n\nSupported signture schemes:\n\n    SHA224withECDSA\n    SHA256withECDSA\n    SHA384withECDSA\n    SHA512withECDSA\n    SHA3-224withECDSA\n    SHA3-256withECDSA\n    SHA3-384withECDSA\n    SHA3-512withECDSA\n    RIPEMD160withECDSA\n    SM3withSM2\n    SHA512withEdDSA\n\nTo verify a signature, just input the public key as well as the signature with\nthe original message.\n```go\nimport \"github.com/zhaohaijun/blockchain-crypto/signature\"\n\n// Generate signature for @msg using private key @private\nsig, err := signature.Sign(signature.SHA256withECDSA, private, msg, nil)\n\n// Verify the signature using public key @public\nok := signature.Verify(public, msg, sig)\n```\n\nSerialization:\n\n```\n// Serialization\nbuf, err := signature.Serialize(sig)\n\n// Deserialization\nsig, err = signature.Deserialize(buf)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaohaijun%2Fblockchain-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhaohaijun%2Fblockchain-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhaohaijun%2Fblockchain-crypto/lists"}