问题描述
下面是几行java代码,谁能转成c#代码:java.security.MessageDigestmd=java.security.MessageDigest.getInstance("MD5");StringBufferresult=newStringBuffer();try{for(byteb:md.digest(buffer.toString().getBytes("UTF-8"))){result.append(Integer.toHexString((b&0xf0)>>>4));result.append(Integer.toHexString(b&0x0f));}}
解决方案
解决方案二:
publicstaticstringEncryptPassword(stringPasswordString,stringPasswordFormat){stringEncryptPassword=null;if("SHA1".Equals(PasswordFormat)){EncryptPassword=FormsAuthentication.HashPasswordForStoringInConfigFile(PasswordString,"SHA1");}elseif("MD5".Equals(PasswordFormat)){EncryptPassword=FormsAuthentication.HashPasswordForStoringInConfigFile(PasswordString,"MD5");}else{EncryptPassword=PasswordString;}returnEncryptPassword.ToLower();}
解决方案三:
引用1楼cf_nxcxy的回复:
C#codepublicstaticstringEncryptPassword(stringPasswordString,stringPasswordFormat){stringEncryptPassword=null;if("SHA1".Equals(PasswordFormat)){……
牛X2种语言都会
解决方案四:
頂.加密算法.