簡體   English   中英

它是什么代碼以及如何在 php 中重寫

[英]What code it is and how to rewrite in php

我從一個 api 提供者那里得到了這個代碼

不確定它的 asp .net 或其他東西

需要轉換成php

我嘗試了一些在線工具,但沒有運氣。

Some One 幫助它是什么代碼以及我如何轉換為 php。

            string CrypCode = (DateTime.Now.Year.ToString()+ (Seed + DateTime.Now.DayOfYear.ToString()));
            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
            byte[] bs = System.Text.Encoding.UTF8.GetBytes(CrypCode);
            bs = x.ComputeHash(bs);
            System.Text.StringBuilder s = new System.Text.StringBuilder();
            foreach (byte b in bs)
            {
                s.Append(b.ToString("x2").ToLower());
            }
            string KEY = s.ToString();
            return KEY;

我記得當我曾經使用 VB.NET 時。 哈希很頭疼。 我看到你正在嘗試 md5 哈希密碼。 在 php 中它很簡單。 不知道為什么微軟的語言很長。 他們一定有他們的理由。 信不信由你在 php 它的一行。

$crypcode = date("Y") + ($seed + date("z"));
$key = md5($crypcode);
return $key;

http://php.net/manual/en/function.md5.php

http://php.net/manual/en/function.date.php

https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.md5cryptoserviceprovider

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM