C 加密幫助類EncryptHelper

2021-08-27 04:22:16 字數 2418 閱讀 8697

///

之前這篇加密幫助類覺得不夠嚴謹,

不夠強,所以特意修改

,也對自己負責一點,如果對你有幫助可以看看

,///

呵呵!~

這個類都經過本人測試過都沒問題

.using

system;

using

system.collections.generic;

using

system.io;

using

system.linq;

using

system.runtime.serialization.formatters.binary;

using

system.security.cryptography;

using

system.text;

using

log4net;

namespace

utility

catch

(exception

ex)

return

afterstring; }

///

///方法二

///hashalgorithm加密

///這種加密是  字母加-

加字元  

///example: password是

admin 

加密變成後

19-a2-85-41-44-b6-3a-8f-76-17-a6-f2-25-01-9b-12

//////

///public

string

hashencrypt(

string

password)

catch

(exception

ex)

return

bitconverter

.tostring(hashedbytes);

//md5加密}

///

///方法三:

///md5  +   hashcode加密

///example: password是

admin 

加密變成後 

895b7da64943134be17b825ce118456c

//////

public

string

md5hashcodeencrypt(

string

encryptpwd)

///

///方法四:

///hashcode +md5 加密

///example: password是

admin 

加密變成後

eb-1d-6d-e2-fc-f1-cd-94-4d-75-78-e6-3d-7a-12-32

//////

///public

string

hashcodemd5encrypt(

string

encryptpwd)

///

///方法五

/////////

public

string

hashmd5encrypt(

string

encryptpwd)

///

///方法六

///哈哈是不是有點暈呢?

///大傢伙可以繼續寫.

//////

///public

string

md5hashencrypt(

string

encryptpwd)

///

///64位雙重

md5小寫

//////

public

static

string

last64(

strings)

//////

32位大寫

//////

public

static

string

upper32(

strings)

//////

32位小寫

//////

public

static

string

lower32(

strings)

//////

16位大寫

//////

public

static

string

upper16(

strings)

//////

16位小寫

//////

public

static

string

lower16(

strings)

} }

加密解密幫助類(對稱加密)

1 對稱加密幫助類 2public static class cryptohelper3 22 provider.key encoding.utf8.getbytes key 2324 encryptor provider.createencryptor 25 建立明文流 26byte clearb...

C DES加密 解密幫助類

des加密 解密幫助類 system.web.security.formsauthentication.hashpasswordforstoringinconfigfile 這個已經廢棄了,是乙個在.net 4.5中已經廢棄不用的api,參見 private static string deskey...

C 公共幫助類 Image幫助類

大家知道,開發專案除了資料訪問層很重要外,就是common了,這裡就提供了強大且實用的工具。c 公共幫助類 convert幫助類 image類 using system using system.collections.generic using system.text using system.i...