using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using login.Models;
namespace login.Helpers
{
public class MainHelper
{
public static string MD5Hash(string input)
{
MD5 md5 = System.Security.Cryptography.MD5.Creat e();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();
}
public static string Random32()
{
return Guid.NewGuid().ToString("N");
}
public static user InitUser(int Id)
{
OurdbDataContext db = new OurdbDataContext();
return db.users.Where(x => x.Id == Id).FirstOrDefault();
}
}
}