⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 util.cs

📁 很好用的一个C#编写的精巧的加解密算法源码。
💻 CS
字号:
using System;

namespace TeaCrypto
{
	/// <summary>
	/// Helper methods used by TEA Algorithms.
	/// </summary>
	public class Util
	{
		// Ctor.
		public Util()
		{
		}

		/// <summary>
		/// Converts a string of length 4 to a 32-bit unsigned integer.
		/// </summary>
		/// <param name="Input">The string of length 4 to convert.</param>
		/// <returns>An encoded integer value representing a string of length 4.</returns>
		public static uint ConvertStringToUInt(string Input)
		{
			uint output;
			output =  ((uint)Input[0]);
			output += ((uint)Input[1] << 8);
			output += ((uint)Input[2] << 16);
			output += ((uint)Input[3] << 24);
			return output;
		}

		/// <summary>
		/// Converts a 32-bit unsigned integer to a string of length 4.
		/// </summary>
		/// <param name="Input">The unsigned integer to convert to a string.</param>
		/// <returns>A string value represented by the encoded integer.</returns>
		public static string ConvertUIntToString(uint Input)
		{
			System.Text.StringBuilder output = new System.Text.StringBuilder();
			output.Append((char)((Input & 0xFF)));
			output.Append((char)((Input >> 8) & 0xFF));
			output.Append((char)((Input >> 16) & 0xFF));
			output.Append((char)((Input >> 24) & 0xFF));
			return output.ToString();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -