Extension for get the MD5 value from a stream




    C# recipes

    The code computes the MD5 hash of the data in the stream and returns that value as a string.

    Shortcut: ex_md5_from_stream

    public static string GetMD5(this System.IO.Stream stream)
      stream.Position = 0;
      var arrayByteHashValue = new System.Security.Cryptography.MD5CryptoServiceProvider().ComputeHash(stream);
      return BitConverter.ToString(arrayByteHashValue).Replace("-", String.Empty).ToLower();
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.