Re: [Libguestfs] [PATCH 03/10] builder: add SHA256 support in Checksums

Richard W.M. Jones
Tue, 28 Jul 2015 11:01:11 -0000

On Tue, Jul 28, 2015 at 11:24:43AM +0200, Pino Toscano
wrote:
> ---
>  builder/checksums.ml  | 4 ++++
>  builder/checksums.mli | 1 +
>  2 files changed, 5 insertions(+)
>
> diff --git a/builder/checksums.ml b/builder/checksums.ml
> index 73d541f..25b3328 100644
> --- a/builder/checksums.ml
> +++ b/builder/checksums.ml
> @@ -24,17 +24,21 @@ open Utils
>  open Printf
>
>  type csum_t > +| SHA256 of string
>  | SHA512 of string
>
>  let string_of_csum_t = function
> +  | SHA256 _ -> "sha256"
>    | SHA512 _ -> "sha512"
>
>  let string_of_csum = function
> +  | SHA256 c -> c
>    | SHA512 c -> c
>
>  let verify_checksum csum filename >    let prog, csum_ref >
match csum with
> +    | SHA256 c -> "sha256sum", c
>      | SHA512 c -> "sha512sum", c
>    in
>
> diff --git a/builder/checksums.mli b/builder/checksums.mli
> index 6833879..4dc9dc0 100644
> --- a/builder/checksums.mli
> +++ b/builder/checksums.mli
> @@ -17,6 +17,7 @@
>   *)
>
>  type csum_t > +| SHA256 of string
>  | SHA512 of string
>
>  val verify_checksum : csum_t -> string -> unit
> --

ACK.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.