In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to generate an hourly user name in c#. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
I am working on an ASP.NET project and want to keep a super admin account.
If the user name of the super administrator is fixed (for example, administrator), this is not safe; so you want to generate a long string user name in the following way and change it every hour.
The composition of the user name: year + total days of SuperAdmin+ + hours à for MD5 encryption. As a result, the user name changes from hour to hour.
Using System;using System.Text;using System.Security.Cryptography;namespace CKI.JsonServer.Models {public class SuperAdministratorHelper {public static string GetName () {int year = DateTime.Now.Year; int month = DateTime.Now.Month; int day = DateTime.Now.Day; int hour = DateTime.Now.Hour; int SumDays = GetDayOfYear (month) + day If (month > 2) {if ((year% 4 = = 0) & & (year% 100! = 0) | | year% 400 = = 0) {SumDays++;}} string sa = year + "SuperAdmin" + SumDays.ToString ("# 000") + hour.ToString ("# 00") Return MD5 (sa);} public static string MD5 (string str) {byte [] result = Encoding.Default.GetBytes (str); MD5 md5 = new MD5CryptoServiceProvider (); byte [] output = md5.ComputeHash (result); string strMD5 = BitConverter.ToString (output) .replace ("-", "); return strMD5 } private static int GetDayOfYear (int month/* value range: 1 to 12 seconds /) {int SumDays = 0; if (month
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.