{"id":211,"date":"2007-02-10T23:41:36","date_gmt":"2007-02-10T21:41:36","guid":{"rendered":"https:\/\/alax.info\/blog\/211"},"modified":"2007-02-10T23:45:12","modified_gmt":"2007-02-10T21:45:12","slug":"md5-and-sha-1-using-cryptoapi-from-jscript","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/211","title":{"rendered":"MD5 and SHA-1 using CryptoAPI from JScript"},"content":{"rendered":"<p>Alax.Info Crypt Tools provides an interface to popular cryptography hash functions (AKA one-way functions) for scripting code, such as JScript\/JavaScript, VBScript etc. Also might be used in other COM\/OLE\/ActiveX compatible environments, however this makes less sense due to presence of native API. The usage is rather simple:<\/p>\n<p style=\"margin-left: 40px\"><span style=\"font-style: italic\">function MD5(Text)<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">{<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">  Hash = WScript.CreateObject(&#8220;AlaxInfo.CryptTools.Md5Hash&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">  Hash.AddStringA(Text);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">  WScript.Echo(&#8220;MD5(\\&#8221;&#8221; + Text + &#8220;\\&#8221;): &#8221; + Hash.GetHashString());<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">}<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;a&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;abc&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;message digest&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;abcdefghijklmnopqrstuvwxyz&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&#8221;);<\/span><br style=\"font-style: italic\" \/><span style=\"font-style: italic\">MD5(&#8220;12345678901234567890123456789012345678901234567890123456789012345678901234567890&#8221;);<\/span><\/p>\n<p><a href=\"http:\/\/tools.ietf.org\/html\/rfc1321\">MD5 <\/a>and <a href=\"http:\/\/en.wikipedia.org\/wiki\/SHA_hash_functions\">SHA-1<\/a> algorithms are implemented (more to appear when necessary).<\/p>\n<p>Keywords: <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa380256.aspx\">CryptoAPI<\/a>, <a href=\"http:\/\/tools.ietf.org\/html\/rfc1321\">MD5 (Message-Digest algorithm 5; RFC 1321)<\/a>, <a href=\"http:\/\/en.wikipedia.org\/wiki\/SHA_hash_functions\">SHA-1<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/7770475c(VS.80).aspx\">CCryptProv<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/ekhbsfk5(VS.80).aspx\">CCryptMD5Hash<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/tfdcwd1y(VS.80).aspx\">CCryptSHAHash<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/zk31y6eh(VS.80).aspx\">CCryptSHA1Hash<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/aa382465.aspx\">HCRYPTHASH<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa379886.aspx\">CryptAcquireContext<\/a>, <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/aa380202.aspx\">CryptHashData<\/a><\/p>\n<p>Application Name: Alax.Info Crypt Tools<br \/>\nLicense: Free for personal use, request commercial licenses via email or <a href=\"https:\/\/alax.info\/about\/\">contact form<\/a><br \/>\nLatest Version: 1.0.0<br \/>\nDownload Link: <a id=\"p123\" href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2007\/02\/crypttoolssetup-100.msi\">Alax.Info Crypt Tools 1.0.0<\/a> (225K)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Alax.Info Crypt Tools provides an interface to popular cryptography hash functions (AKA one-way functions) for scripting code, such as JScript\/JavaScript, VBScript etc. Also might be used in other COM\/OLE\/ActiveX compatible environments, however this makes less sense due to presence of native API. The usage is rather simple: function MD5(Text){ Hash = WScript.CreateObject(&#8220;AlaxInfo.CryptTools.Md5Hash&#8221;); Hash.AddStringA(Text); WScript.Echo(&#8220;MD5(\\&#8221;&#8221; +&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/211\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,21,2],"tags":[],"class_list":["post-211","post","type-post","status-publish","format-standard","hentry","category-atl","category-seriously","category-utilities"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/211","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=211"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/211\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}