{"id":232,"date":"2010-05-24T20:14:23","date_gmt":"2010-05-24T20:14:23","guid":{"rendered":"http:\/\/psyphi.net\/blog\/?p=232"},"modified":"2010-05-24T20:16:20","modified_gmt":"2010-05-24T20:16:20","slug":"generating-mscache-ntlm-hashes-using-perl","status":"publish","type":"post","link":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/","title":{"rendered":"Generating MSCACHE &#038; NTLM hashes using Perl"},"content":{"rendered":"<p>I&#8217;ve been doing a lot of tinkering recently whilst working on the revised <a href=\"http:\/\/rainbowcracklimited.com\/\">rainbowcracklimited.com<\/a> website. Naturally it uses Perl on the back end so I&#8217;ve had to find out how to make Windows-style hashes of various types using largely non-native means.<\/p>\n<p>On the whole I&#8217;ve been able to make good use of the wealth of CPAN modules &#8211; <a href=\"http:\/\/search.cpan.org\/search?query=digest::md4\">Digest::MD4<\/a>, <a href=\"http:\/\/search.cpan.org\/search?query=digest::md5\">Digest::MD5<\/a>, <a href=\"http:\/\/search.cpan.org\/search?query=digest::sha\">Digest::SHA<\/a> and <a href=\"http:\/\/search.cpan.org\/search?query=authen::passphrase\">Authen::Passphrase<\/a> but for one reason and another I&#8217;ve wanted to find out how to make NTLM and MSCACHE hashes &#8220;by-hand&#8221;. It turns out this is pretty easy:<\/p>\n<p>NTLM is just a MD4 digest of the password in Unicode, or to be specific utf16 2-byte characters + surrogates:<\/p>\n<p><code>perl -M\"Unicode::String latin1\" -M\"Digest::MD4 md4_hex\" -e 'print md4_hex(latin1(\"cheese\")-&gt;utf16le),\"\\n\"'<\/code><\/p>\n<p>MSCACHE is a little bit more fiddly as it also encodes the Unicode username as well:<\/p>\n<p><code>perl -M\"Unicode::String latin1\" -M\"Digest::MD4 md4_hex\" -e 'print md4_hex(latin1(\"cheese\")-&gt;utf16le . latin1(lc \"Administrator\")-&gt;utf16le),\"\\n\"'<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I&#8217;ve had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I&#8217;ve been able to make good use of the wealth of &hellip; <a href=\"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Generating MSCACHE &#038; NTLM hashes using Perl&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[11,17],"tags":[381,379,380,385,383,382,21,384],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-programming","category-sysadmin","tag-cracking","tag-hashes","tag-hashing","tag-mscache","tag-ntlm","tag-passwords","tag-perl","tag-unicode"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"I&#039;ve been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I&#039;ve had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I&#039;ve been able to make good use of the wealth of\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Roger Pettett\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"psyphi.net blog - Another collection of braingunk and technolint\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Generating MSCACHE &amp; NTLM hashes using Perl - psyphi.net blog\" \/>\n\t\t<meta property=\"og:description\" content=\"I&#039;ve been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I&#039;ve had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I&#039;ve been able to make good use of the wealth of\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2010-05-24T20:14:23+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2010-05-24T20:16:20+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Generating MSCACHE &amp; NTLM hashes using Perl - psyphi.net blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"I&#039;ve been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I&#039;ve had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I&#039;ve been able to make good use of the wealth of\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#blogposting\",\"name\":\"Generating MSCACHE & NTLM hashes using Perl - psyphi.net blog\",\"headline\":\"Generating MSCACHE &#038; NTLM hashes using Perl\",\"author\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/author\\\/rmp\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/#organization\"},\"datePublished\":\"2010-05-24T20:14:23+00:00\",\"dateModified\":\"2010-05-24T20:16:20+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#webpage\"},\"articleSection\":\"programming, sysadmin, cracking, hashes, hashing, mscache, ntlm, passwords, perl, unicode\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/psyphi.net\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/category\\\/programming\\\/#listItem\",\"name\":\"programming\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/category\\\/programming\\\/#listItem\",\"position\":2,\"name\":\"programming\",\"item\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/category\\\/programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#listItem\",\"name\":\"Generating MSCACHE &#038; NTLM hashes using Perl\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#listItem\",\"position\":3,\"name\":\"Generating MSCACHE &#038; NTLM hashes using Perl\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/category\\\/programming\\\/#listItem\",\"name\":\"programming\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/#organization\",\"name\":\"psyphi.net blog\",\"description\":\"Another collection of braingunk and technolint\",\"url\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/author\\\/rmp\\\/#author\",\"url\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/author\\\/rmp\\\/\",\"name\":\"Roger Pettett\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f715f8335258578c567eb8c22335f1cee22c971c2aff8be27c4d8d934c436503?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Roger Pettett\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#webpage\",\"url\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/\",\"name\":\"Generating MSCACHE & NTLM hashes using Perl - psyphi.net blog\",\"description\":\"I've been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I've had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I've been able to make good use of the wealth of\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/2010\\\/05\\\/generating-mscache-ntlm-hashes-using-perl\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/author\\\/rmp\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/author\\\/rmp\\\/#author\"},\"datePublished\":\"2010-05-24T20:14:23+00:00\",\"dateModified\":\"2010-05-24T20:16:20+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/\",\"name\":\"psyphi.net blog\",\"description\":\"Another collection of braingunk and technolint\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/psyphi.net\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Generating MSCACHE & NTLM hashes using Perl - psyphi.net blog","description":"I've been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I've had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I've been able to make good use of the wealth of","canonical_url":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#blogposting","name":"Generating MSCACHE & NTLM hashes using Perl - psyphi.net blog","headline":"Generating MSCACHE &#038; NTLM hashes using Perl","author":{"@id":"https:\/\/psyphi.net\/blog\/author\/rmp\/#author"},"publisher":{"@id":"https:\/\/psyphi.net\/blog\/#organization"},"datePublished":"2010-05-24T20:14:23+00:00","dateModified":"2010-05-24T20:16:20+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#webpage"},"isPartOf":{"@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#webpage"},"articleSection":"programming, sysadmin, cracking, hashes, hashing, mscache, ntlm, passwords, perl, unicode"},{"@type":"BreadcrumbList","@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog#listItem","position":1,"name":"Home","item":"https:\/\/psyphi.net\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog\/category\/programming\/#listItem","name":"programming"}},{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog\/category\/programming\/#listItem","position":2,"name":"programming","item":"https:\/\/psyphi.net\/blog\/category\/programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#listItem","name":"Generating MSCACHE &#038; NTLM hashes using Perl"},"previousItem":{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#listItem","position":3,"name":"Generating MSCACHE &#038; NTLM hashes using Perl","previousItem":{"@type":"ListItem","@id":"https:\/\/psyphi.net\/blog\/category\/programming\/#listItem","name":"programming"}}]},{"@type":"Organization","@id":"https:\/\/psyphi.net\/blog\/#organization","name":"psyphi.net blog","description":"Another collection of braingunk and technolint","url":"https:\/\/psyphi.net\/blog\/"},{"@type":"Person","@id":"https:\/\/psyphi.net\/blog\/author\/rmp\/#author","url":"https:\/\/psyphi.net\/blog\/author\/rmp\/","name":"Roger Pettett","image":{"@type":"ImageObject","@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/f715f8335258578c567eb8c22335f1cee22c971c2aff8be27c4d8d934c436503?s=96&d=mm&r=g","width":96,"height":96,"caption":"Roger Pettett"}},{"@type":"WebPage","@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#webpage","url":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/","name":"Generating MSCACHE & NTLM hashes using Perl - psyphi.net blog","description":"I've been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I've had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I've been able to make good use of the wealth of","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/psyphi.net\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/#breadcrumblist"},"author":{"@id":"https:\/\/psyphi.net\/blog\/author\/rmp\/#author"},"creator":{"@id":"https:\/\/psyphi.net\/blog\/author\/rmp\/#author"},"datePublished":"2010-05-24T20:14:23+00:00","dateModified":"2010-05-24T20:16:20+00:00"},{"@type":"WebSite","@id":"https:\/\/psyphi.net\/blog\/#website","url":"https:\/\/psyphi.net\/blog\/","name":"psyphi.net blog","description":"Another collection of braingunk and technolint","inLanguage":"en-US","publisher":{"@id":"https:\/\/psyphi.net\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"psyphi.net blog - Another collection of braingunk and technolint","og:type":"article","og:title":"Generating MSCACHE &amp; NTLM hashes using Perl - psyphi.net blog","og:description":"I've been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I've had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I've been able to make good use of the wealth of","og:url":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/","article:published_time":"2010-05-24T20:14:23+00:00","article:modified_time":"2010-05-24T20:16:20+00:00","twitter:card":"summary_large_image","twitter:title":"Generating MSCACHE &amp; NTLM hashes using Perl - psyphi.net blog","twitter:description":"I've been doing a lot of tinkering recently whilst working on the revised rainbowcracklimited.com website. Naturally it uses Perl on the back end so I've had to find out how to make Windows-style hashes of various types using largely non-native means. On the whole I've been able to make good use of the wealth of"},"aioseo_meta_data":{"post_id":"232","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-05-16 14:00:01","updated":"2025-08-15 17:25:13","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/psyphi.net\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/psyphi.net\/blog\/category\/programming\/\" title=\"programming\">programming<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tGenerating MSCACHE &amp; NTLM hashes using Perl\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/psyphi.net\/blog"},{"label":"programming","link":"https:\/\/psyphi.net\/blog\/category\/programming\/"},{"label":"Generating MSCACHE &#038; NTLM hashes using Perl","link":"https:\/\/psyphi.net\/blog\/2010\/05\/generating-mscache-ntlm-hashes-using-perl\/"}],"_links":{"self":[{"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":5,"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"predecessor-version":[{"id":237,"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/posts\/232\/revisions\/237"}],"wp:attachment":[{"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/psyphi.net\/blog\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}