1. <legend id='HSw1L'><style id='HSw1L'><dir id='HSw1L'><q id='HSw1L'></q></dir></style></legend>

    <small id='HSw1L'></small><noframes id='HSw1L'>

      <bdo id='HSw1L'></bdo><ul id='HSw1L'></ul>

  2. <i id='HSw1L'><tr id='HSw1L'><dt id='HSw1L'><q id='HSw1L'><span id='HSw1L'><b id='HSw1L'><form id='HSw1L'><ins id='HSw1L'></ins><ul id='HSw1L'></ul><sub id='HSw1L'></sub></form><legend id='HSw1L'></legend><bdo id='HSw1L'><pre id='HSw1L'><center id='HSw1L'></center></pre></bdo></b><th id='HSw1L'></th></span></q></dt></tr></i><div id='HSw1L'><tfoot id='HSw1L'></tfoot><dl id='HSw1L'><fieldset id='HSw1L'></fieldset></dl></div>

      <tfoot id='HSw1L'></tfoot>

    1. 比较 C# 和 ColdFusion 之间的密码哈希 (CFMX_COMPAT)

      时间:2023-06-05
        <bdo id='hvzQR'></bdo><ul id='hvzQR'></ul>

      • <small id='hvzQR'></small><noframes id='hvzQR'>

              <tfoot id='hvzQR'></tfoot>
                <tbody id='hvzQR'></tbody>
            1. <i id='hvzQR'><tr id='hvzQR'><dt id='hvzQR'><q id='hvzQR'><span id='hvzQR'><b id='hvzQR'><form id='hvzQR'><ins id='hvzQR'></ins><ul id='hvzQR'></ul><sub id='hvzQR'></sub></form><legend id='hvzQR'></legend><bdo id='hvzQR'><pre id='hvzQR'><center id='hvzQR'></center></pre></bdo></b><th id='hvzQR'></th></span></q></dt></tr></i><div id='hvzQR'><tfoot id='hvzQR'></tfoot><dl id='hvzQR'><fieldset id='hvzQR'></fieldset></dl></div>
              • <legend id='hvzQR'><style id='hvzQR'><dir id='hvzQR'><q id='hvzQR'></q></dir></style></legend>
                本文介绍了比较 C# 和 ColdFusion 之间的密码哈希 (CFMX_COMPAT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我有一个密码哈希,它存储在一个表中,并由以下冷融合脚本放在那里-

                I have a password hash that is stored in a table and is put there by the following coldfusion script-

                #Hash(Encrypt(Form.UserPassword,GetSiteVars.EnCode))#
                

                我正在尝试在 c# 应用程序中添加一些外部功能.我希望能够利用已经存在的数据,以便对用户进行身份验证.有谁知道我如何在 c# 中复制上述冷融合代码?

                I am trying to add some outside functionality within a c# application. I would like to be able to take advantage of the data that already exists so that I can authenticate users. Does anyone know how I can replicate the above coldfusion code in c#?

                感谢您的任何想法.

                推荐答案

                我将把原来的答案内容留在下面以供历史参考,但需要注意的是,这不是对原始问题的有效答案.

                I'll leave the original answer content below for historical reference, but it should be noted that this is NOT a working answer to the original question.

                相反,请参阅 2011 年 1 月 @Terrapin 在此线程中投票最多的答案.我希望 OP 看到这一点并可以更改接受的答案.哎呀,我什至会标记模组,看看是否可以对此做任何事情.

                Instead, see the top-voted answer in this thread, by @Terrapin in January 2011. I hope the OP sees this and can change the accepted answer. Heck, I'll even flag the mods to see if anything can be done about this.

                根据 Edward Smith 的回答和 czuroski 的后续评论,这是我的解决方案.

                To build on the answer by Edward Smith, and the follow-up comments by czuroski, here is my solution.

                首先,你需要一个 C# 中的 XOR 函数,我取自 这里并稍作修改.

                First, you need an XOR function in C#, which I've taken from here and modified slightly.

                using System;
                using System.Collections.Generic;
                using System.Text;
                
                namespace SimpleXOREncryption
                {    
                    public static class EncryptorDecryptor
                    {
                        public static string EncryptDecrypt(string textToEncrypt, int key)
                        {            
                            StringBuilder inSb = new StringBuilder(textToEncrypt);
                            StringBuilder outSb = new StringBuilder(textToEncrypt.Length);
                            char c;
                            for (int i = 0; i < textToEncrypt.Length; i++)
                            {
                                c = inSb[i];
                                c = (char)(c ^ key);
                                outSb.Append(c);
                            }
                            return outSb.ToString();
                        }   
                    }
                }
                

                然后,取 XOR 的结果并进行 base-64 编码.获得该字符串后,MD5 对其进行哈希处理.结果应该与原始代码片段的结果相匹配:

                Then, take the result of the XOR and base-64 encode it. After you have that string, MD5 hash it. The result should match the result from the original code snippet:

                #Hash(Encrypt(Form.UserPassword,GetSiteVars.EnCode))#
                

                这篇关于比较 C# 和 ColdFusion 之间的密码哈希 (CFMX_COMPAT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:从文本框值插入数字(十进制)数据 下一篇:ColdFusion - cfusion_encrypt() 和 cfusion_decrypt() - C# 替代

                相关文章

                最新文章

                <i id='ni7Us'><tr id='ni7Us'><dt id='ni7Us'><q id='ni7Us'><span id='ni7Us'><b id='ni7Us'><form id='ni7Us'><ins id='ni7Us'></ins><ul id='ni7Us'></ul><sub id='ni7Us'></sub></form><legend id='ni7Us'></legend><bdo id='ni7Us'><pre id='ni7Us'><center id='ni7Us'></center></pre></bdo></b><th id='ni7Us'></th></span></q></dt></tr></i><div id='ni7Us'><tfoot id='ni7Us'></tfoot><dl id='ni7Us'><fieldset id='ni7Us'></fieldset></dl></div>

                  <small id='ni7Us'></small><noframes id='ni7Us'>

                  • <bdo id='ni7Us'></bdo><ul id='ni7Us'></ul>
                  1. <tfoot id='ni7Us'></tfoot>

                    <legend id='ni7Us'><style id='ni7Us'><dir id='ni7Us'><q id='ni7Us'></q></dir></style></legend>