Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6730157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:22:27+00:00 2026-05-26T10:22:27+00:00

When using CAPICOM in Classic ASP (VBScript) to perform MD5 hashing like so: With

  • 0

When using CAPICOM in Classic ASP (VBScript) to perform MD5 hashing like so:

With server.CreateObject("CAPICOM.HashedData")
    .Algorithm = 3                  ' CAPICOM_HASH_ALGORITHM_MD5
    .Hash "password"

    md5Pwd = .Value
End With

I get this result: B081DBE85E1EC3FFC3D4E7D0227400CD

When I use .NET, I get this result: 5f4dcc3b5aa765d61d8327deb882cf99

Why are the MD5 strings different? What am I doing wrong?

Here is my C# function:

MD5 md5Hasher = MD5.Create();
byte[] data = md5Hasher.ComputeHash( Encoding.Default.GetBytes( val ) );

StringBuilder sBuilder = new StringBuilder();

// Loop through each byte of the hashed data 
// and format each one as a hexadecimal string.
for( int i = 0; i < data.Length; i++ ) {
    sBuilder.Append( data[i].ToString( "x2" ) );
}

// Return the hexadecimal string.
return sBuilder.ToString();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:22:28+00:00Added an answer on May 26, 2026 at 10:22 am

    The problem is that you are using Encoding.Default encoding which represents 7 bit ASCII characters. At the same time, “CAPICOM manipulates only Unicode strings while validating and generating digital signatures”.

    So, Encoding.Default.GetBytes deals with one-byte characters (losing any non-ASCII data by the way), while CAPICOM.HashedData treats them as 2-byte Unicode characters.

    Replace Encoding.Default with Encoding.Unicode to make your .NET implementation to be compatible with CAPICOM.

    One more note, use data[i].ToString("X2") to produce upper-case result, as you have in CAPICOM implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using ASP.NET MVC there are situations (such as form submission) that may require a
Does size matter when choosing the right algorithm to use for a session hash.
Using PHP I'd like to compare an actual ip address to part of one,
Using Rails 3.2.0 with haml and sass: I Would like to link an external
Using SQL Server 2005 Leave Table ID StartDate EndDate 001 02/03/2010 02/03/2010 002 02/03/2010
Using the classic code snippet: if (x & (x-1)) == 0 If the answer
using SQL Server 2005 standard edition with SP2 I need to design a table
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
Using online interfaces to a version control system is a nice way to have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.