Marshal Str : SHA1Managed « Security « C# / C Sharp






Marshal Str

 

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Collections.Generic;

public static class Utilities
{

    public unsafe static string MarshalStr(IntPtr p)
    {
        // instead of 
        // System.Runtime.InteropServices.Marshal.PtrToStringAuto(p)
        sbyte* ps = (sbyte*)p;
        int size = 0;
        for (; ps[size] != 0; ++size)
            ;
        return new String(ps, 0, size);
    }
}

   
  








Related examples in the same category

1.new SHA1Managed()
2.Encrypt SHA1
3.Encrypt SHA256
4.Returns a SHA1 hash of a given plaintext
5.SHA256 crypt
6.Get SHA1 for a string
7.Get SHA256 for a string
8.Get SHA38 for a string
9.Get SHA512 for a string
10.Encrypts a string using the SHA256 algorithm.