src/stdlib/digest/sha256.panack
Green: covered; red: known zero; amber: unavailable. Blank lines are outside the executable-start-line denominator.
1 import stdlib/digest/sha256/errors as errors 2 pub import stdlib/digest/sha256/errors::{Sha256Error, Sha256ErrorKind, Sha256Operation} 3 import stdlib/digest/sha256/errors::{Sha256Operation.Create, Sha256Operation.Update, Sha256Operation.Finish, Sha256Operation.Close} 4 pub import stdlib/host::{HostError} 5 6 // Handles belong to this invocation. Async mutations yield after one bounded step. 7 pub create(): Result[Sha256Context,Sha256Error] { 8 errors.convert(sha256_create(), Create()) 9 } 10 11 pub update(context: Sha256Context, data: Bytes): Result[Unit,Sha256Error] { 12 errors.convert(sha256_update(context, data), Update(data.length())) 13 } 14 15 pub finish(context: Sha256Context): Result[Bytes,Sha256Error] { 16 errors.convert(sha256_finish(context), Finish()) 17 } 18 19 pub close(context: Sha256Context): Result[Unit,Sha256Error] { 20 errors.convert(sha256_close(context), Close()) 21 } 22 23 // One-shot input is bounded to 16 MiB. Use a context for larger inputs. 24 pub pure hash(data: Bytes): Bytes { sha256_hash(data) } 25
Functions
[
{
"id": "declaration/4",
"name": "create",
"line": 7,
"state": "covered",
"entries": "4"
},
{
"id": "declaration/5",
"name": "update",
"line": 11,
"state": "covered",
"entries": "5"
},
{
"id": "declaration/6",
"name": "finish",
"line": 15,
"state": "covered",
"entries": "4"
},
{
"id": "declaration/7",
"name": "close",
"line": 19,
"state": "covered",
"entries": "2"
},
{
"id": "declaration/8",
"name": "hash",
"line": 24,
"state": "covered",
"entries": "10"
}
]Source branch outcomes
[]
Reviewed declaration exclusions
[
{
"id": "declaration/0",
"reason": "import",
"line": 1
},
{
"id": "declaration/1",
"reason": "import",
"line": 2
},
{
"id": "declaration/2",
"reason": "import",
"line": 3
},
{
"id": "declaration/3",
"reason": "import",
"line": 4
},
{
"id": "declaration/4/tail/receiver",
"reason": "namespace-qualifier",
"line": 8
},
{
"id": "declaration/5/tail/receiver",
"reason": "namespace-qualifier",
"line": 12
},
{
"id": "declaration/6/tail/receiver",
"reason": "namespace-qualifier",
"line": 16
},
{
"id": "declaration/7/tail/receiver",
"reason": "namespace-qualifier",
"line": 20
}
]