如何实现标题为“"”的文章中使用的hmacsha1 [英] how to implement hmacsha1 used in an article titled""

查看:102
本文介绍了如何实现标题为“"”的文章中使用的hmacsha1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好每一个

i想知道如何从这个链接实现hmacsha1 OTP(一次性密码)揭秘 [ ^ ]

i尝试在控制台应用程序中实现它,但结果是密码在每次运行程序时都没有改变,或者相同的密码是每两连续重复一次。这是我的试用版

hello every one
i want to know how to implement hmacsha1 from this link OTP (One Time Password) Demystified[^]
i tried to implement it in a console application but the result is either the password does not change at each time when running the program or same password is repeated at each two consecutive running. here is my trial

<pre lang="c#">class Program
    {
        static void Main(string[] args)
        {
            // OTP otp2 = new OTP();


            try
            {
                OTP otp = new OTP(1, null);
                OTP getcurrent = new OTP();
                string tobyte = getcurrent.GetCurrentOTP();
                byte[] x = OTP.ToByteArray(tobyte);
                string y = OTP.FormatOTP(x);

                Console.WriteLine(y);
             
                OTP getnext = new OTP();
                string tobyte2 = getnext.GetNextOTP();
                Console.WriteLine(tobyte2);
                HmacSha1 hmc = new HmacSha1();
                catch(Exception ex){}
           
                //hmc.Init(key);
                






                //           // OTPCounter counter = new OTPCounter();


                //       // byte[] format = OTP.ToByteArray(tobyte);
                //       // string psw = OTP.FormatOTP(format);

                //    }

                //    catch (IndexOutOfRangeException x) { }

                //        // OTP tobyte2 = new OTP();




           
                       
                //}

            }
        }
    }

推荐答案

撰写文章的人支持文章。在该文章底部的论坛中提出您的问题。
Articles are supported by the people that wrote them. Ask your question in the forum at the bottom of that article.


这篇关于如何实现标题为“&quot;”的文章中使用的hmacsha1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆