Sajay

Life, The Universe and Everything Distributed.

June, 2006

Posts
  • Sajay

    Encode Hex String

    • 0 Comments

    I needed to get the hash as a string from a byte[].
    I was snooping around X509Certificate class and saw a GetHashString method.
    After a bit more digging i ended up at System.Security.Util.Hex this had the method i was looking for. Check out the EncodeHexString method.

            public  static String EncodeHexString(byte[] sArray)

            {

                String result = null;

       

                if(sArray != null) {

                    char[] hexOrder = new char[sArray.Length * 2];

               

                    int digit;

                    for(int i = 0, j = 0; i < sArray.Length; i++) {

                        digit = (int)((sArray[i] & 0xf0) >> 4);

                        hexOrder[j++] = HexDigit(digit);

                        digit = (int)(sArray[i] & 0x0f);

                        hexOrder[j++] = HexDigit(digit);

                    }

                    result = new String(hexOrder);

                }

                return result;

            }

          

           // converts number to hex digit. Does not do any range checks.

            static char HexDigit(int num) {

                return (char)((num < 10) ? (num + '0') : (num + ('A' - 10)));

            }

           

  • Sajay

    STS + ADAM + AzMan

    • 0 Comments

    After having played with STS for some time I came across this interesting read. The scenario that Sam Gentile suggests for roles using AzMan and integrating with WCF is something that more customers should leverage for better value for exisitng infrastrucre that they already posses most of the time.

    Read more

  • Sajay

    Patterns and practices Goes Mobile!

    • 0 Comments

    The Microsoft patterns & practices team has released the first Community Technical Preview (CTP) for the Mobile Client Software Factory.  The factory will help architects and developers design and build mobile LOB solutions.   The Mobile Client Software Factory will include a prescriptive architecture, application blocks, and other guidance/tools for enterprise architects and developers targeting Windows Mobile powered devices. 

Page 1 of 1 (3 items)