当前位置: 首页 > news >正文

大型网站建设 cms cdm dmp网络营销网站建设案例

大型网站建设 cms cdm dmp,网络营销网站建设案例,网站建设怎么谈,洛阳市网站建设文章目录 仓库地址介绍安装用法SHA512HMACBcryptScryptAESRSAECC 仓库地址 仓库地址:https://github.com/palp1tate/go-crypto-guard 欢迎star和fork! 介绍 此存储库包含用 Go 编写的全面的密码哈希库。该库支持多种哈希算法,它允许可定制…

文章目录

    • 仓库地址
    • 介绍
    • 安装
    • 用法
      • SHA512
      • HMAC
      • Bcrypt
      • Scrypt
      • AES
      • RSA
      • ECC

仓库地址

仓库地址:https://github.com/palp1tate/go-crypto-guard

欢迎starfork

介绍

此存储库包含用 Go 编写的全面的密码哈希库。该库支持多种哈希算法,它允许可定制的盐长度、迭代、键长度和算法选择。这个开源项目旨在为开发人员提供一个多功能的工具,用于安全的密码存储和验证。

支持的算法:

  • SHA512
  • SHA384
  • SHA256
  • SHA1
  • Md5
  • HMAC
  • Argon2
  • Bcrypt
  • Scrypt
  • Blake2b
  • Blake2s
  • AES
  • DES
  • 3DES
  • RSA
  • RC4
  • Blowfish
  • ECC

一些加密过后的密码格式与Django内置的加密算法格式相同:

<algorithm>$<iterations>$<salt>$<hash>

其他可能的格式:

<algorithm>$<hash>

安装

go get -u github.com/palp1tate/go-crypto-guard 

用法

SHA512

// SHA512 使用 PBKDF2 和 SHA-512 对密码进行加密。
// 它接受密码、盐长度、密钥长度和迭代次数作为输入。如果你传入一个无效的值,函数将采取默认值。
// 它生成一个盐,使用 PBKDF2 和 SHA-512 派生一个密钥,并返回加密的密码。
// 密码的格式:<algorithm>$<iterations>$<salt>$<hash>
//pbkdf2_sha512$100$40fde046f66c1d9e55b4435d$1fdd34c50a98e576b612d66be507f019password := "12345678"
encodedPassword, _ := pwd.GenSHA512(password, 12, 16, 100)
ok, _ := pwd.VerifySHA512(password, encodedPassword)

SHA384、 SHA256、 SHA1、 Md5和 Argon2的用法与 SHA512相同.

HMAC

// HMAC 使用 HMAC 和 SHA-256 对密码进行加密。
// 它接受密码和盐长度作为输入。
// 它生成一个盐,使用盐和 SHA-256 计算密码的 HMAC,并返回加密的密码。
// 密码的格式:<algorithm>$<salt>$<hash>
//hmac$3bf4e2c1a9ed54575d0d1f937eb363ab$a6ed73f8fe48867db2bd58c69ebe6c0fb91ecdd8147c4352fecf018d07cb4f43password := "12345678"
encodedPassword, _ := pwd.GenHMAC(password, 16)
ok, _ := pwd.VerifyHMAC(password, encodedPassword)

Bcrypt

// Bcrypt 使用 Bcrypt 哈希函数对密码进行加密。
// 它接受一个密码作为输入,使用 Bcrypt 的默认成本从密码生成一个哈希,并返回加密的密码。
// 密码的格式:<algorithm>$<hash>
//bcrypt$243261243130246769545174546869684f565835616a694a4e3578432e6e387a4c426451526932692e443067756758334a436d3532717365784e5661password := "12345678"
encodedPassword, _ := pwd.GenBcrypt(password)
ok, _ := pwd.VerifyBcrypt(password, encodedPassword)

对 Blake2b、 Blake2s 的使用与对 Bcrypt 的使用相同.

Scrypt

// Scrypt 使用 Scrypt 密钥派生函数对密码进行加密。
// 它接受一个密码、盐长度和密钥长度作为输入。
// 它生成一个盐,使用 Scrypt 和提供的参数派生一个密钥,并返回加密的密码。
// 密码的格式:<algorithm>$<salt>$<hash>
//scrypt$679a0a3c8336a9ff36b809862e7d494c$c4cec5ca742fa984045457f76d217acf245f032251c6a3952c4d68e1cba4a488password := "12345678"
encodedPassword, _ := pwd.GenScrypt(password, 16, 32)
ok, _ := pwd.VerifyScrypt(password, encodedPassword)

AES

// AES 使用 AES 加密算法对密码进行加密。
// 它接受一个密码和一个 AES 密钥作为输入。
// 它从 AES 密钥创建一个新的密码块,对密码应用 PKCS7 填充,并使用 CBC 模式加密密码。它返回加密的密码。
// 密码的格式:<algorithm>$<hash>
// aes$BhV9oJiePwpsEwDWizJoCA==password := "12345678"
//aes key的长度必须为32
aesKey := "palpitateabcdefghijklmn123456789"
encodedPassword, _ := pwd.GenAES(password, aesKey)
ok, _ := pwd.VerifyAES(password, encodedPassword, aesKey)

DES、ThreeDES、RC4和Blowfish的使用与Bcrypt相同,对于DES,desKey的长度必须为8。对于ThreeDES,threeDesKey的长度必须为24。rc4Key和BlowfishKey的长度没有限制,但对于Blowfish,密码的长度必须为8。

RSA

// GenRSAKey 生成一对 RSA 密钥并将它们保存到文件中。 
// 它接受密钥的位数作为输入。推荐使用 2048 或 4096。 
// 它生成一个私钥和一个公钥,并分别将它们写入 “privateKey.pem” 和 “publicKey.pem”。// RSA 使用 RSA 加密算法对密码进行加密。 
// 它接受一个密码和公钥文件的路径作为输入。 
// 它从文件中读取公钥,使用 RSA 和 PKCS1v15 填充对密码进行加密,并返回加密的密码。 
// 密码的格式:<algorithm>$<hash> 
//rsa$3p1+X80iFIDtwtKOQFjXm+deyv+cxkEIbpXuwXcqbcCvean6zyWvcrogQtDj2MkYOE2ScHpARR93RYxs3y+RXetKAHhrDqWURYcyJwuTwShBmR4hz+3WkFzhqm44IgPdlgdt70uO7TXx6fj1WmUTsZpNDTF/WNdEUO7Rzc8wahYBcnMOnPgUXrnUCYRSX7OBjuLwThnd9FTgh8CdaqESHWh6UPgkj9xz3G2uRplx2Tae0Pbsk8vQTuJXsqT//Q8yoC+ELo+5S6wTE6H8AMBdgvJgNHzFDldQD8UsZ7Ta/u2uF/joHwBA6V6IS4+1ithspE9ceJZCBWo2Cj6fMIbvjg==// 在你可以加密密码之前,你必须先生成一对密钥。这个函数只能被调用一次,记住在验证密码时需要相同的密钥对。_ = pwd.GenRSAKey(2048)	//只需要执行一次就可以注释掉
password := "12345678"
encodedPassword, _ := pwd.GenRSA(password, "publicKey.pem")
ok, _ := pwd.VerifyRSA(password, encodedPassword, "privateKey.pem")

ECC

// ECC 使用 ECC 加密算法对密码进行加密。
// 它接受一个密码和一个私钥作为输入。
// 它计算密码的 SHA-256 摘要,使用私钥对摘要进行签名,并返回加密的密码。
// 密码的格式:<algorithm>$<hash>
//ecc$BQOoQvBhRHKi9GsV0qpPiyMJ5hRwdiXlQL7CcMsPCo1GvIomtb8xzjNnmq7RNRWmS9AKXo+i0Cg4fmAdLeCN8w==password := "12345678"
privateKey, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
encodedPassword, _ := pwd.GenECC(password, privateKey)
publicKey := privateKey.PublicKey
ok, _ := pwd.VerifyECC(password, encodedPassword publicKey)

文章转载自:
http://propitiator.bpcf.cn
http://connubially.bpcf.cn
http://puller.bpcf.cn
http://manducate.bpcf.cn
http://rheotactic.bpcf.cn
http://psychomotor.bpcf.cn
http://new.bpcf.cn
http://bliny.bpcf.cn
http://inconsequently.bpcf.cn
http://frogmouth.bpcf.cn
http://lardaceous.bpcf.cn
http://courtesy.bpcf.cn
http://plastiqueur.bpcf.cn
http://wroth.bpcf.cn
http://gangdom.bpcf.cn
http://walkthrough.bpcf.cn
http://thinnest.bpcf.cn
http://betrayal.bpcf.cn
http://tracer.bpcf.cn
http://humanistic.bpcf.cn
http://nearsighted.bpcf.cn
http://symbiotic.bpcf.cn
http://deliberately.bpcf.cn
http://attributively.bpcf.cn
http://wastry.bpcf.cn
http://carthage.bpcf.cn
http://turrical.bpcf.cn
http://benzoline.bpcf.cn
http://osculate.bpcf.cn
http://messianic.bpcf.cn
http://precess.bpcf.cn
http://bolan.bpcf.cn
http://beddy.bpcf.cn
http://sabrecut.bpcf.cn
http://commissure.bpcf.cn
http://malic.bpcf.cn
http://chekiang.bpcf.cn
http://december.bpcf.cn
http://smashup.bpcf.cn
http://pneumonolysis.bpcf.cn
http://seedily.bpcf.cn
http://billet.bpcf.cn
http://eximious.bpcf.cn
http://muralist.bpcf.cn
http://viewpoint.bpcf.cn
http://ebracteate.bpcf.cn
http://composure.bpcf.cn
http://impower.bpcf.cn
http://periscopic.bpcf.cn
http://botch.bpcf.cn
http://endomitosis.bpcf.cn
http://midnoon.bpcf.cn
http://hyperrectangle.bpcf.cn
http://heterotransplant.bpcf.cn
http://resourceful.bpcf.cn
http://countryfolk.bpcf.cn
http://nonclaim.bpcf.cn
http://autoerotic.bpcf.cn
http://gonfanon.bpcf.cn
http://zyzzyva.bpcf.cn
http://outskirt.bpcf.cn
http://musician.bpcf.cn
http://underwrought.bpcf.cn
http://malar.bpcf.cn
http://schoolbook.bpcf.cn
http://bedouin.bpcf.cn
http://tonguelet.bpcf.cn
http://fledgy.bpcf.cn
http://prill.bpcf.cn
http://wanta.bpcf.cn
http://ad.bpcf.cn
http://columbine.bpcf.cn
http://tarlatan.bpcf.cn
http://aleyard.bpcf.cn
http://lagune.bpcf.cn
http://resuscitate.bpcf.cn
http://mimas.bpcf.cn
http://harrow.bpcf.cn
http://unpeace.bpcf.cn
http://splitter.bpcf.cn
http://thorntree.bpcf.cn
http://turnip.bpcf.cn
http://drayman.bpcf.cn
http://quatercentennial.bpcf.cn
http://nitwitted.bpcf.cn
http://relocation.bpcf.cn
http://reentrant.bpcf.cn
http://pharmacology.bpcf.cn
http://pipsqueak.bpcf.cn
http://deimos.bpcf.cn
http://terminableness.bpcf.cn
http://bhn.bpcf.cn
http://galati.bpcf.cn
http://productile.bpcf.cn
http://drilling.bpcf.cn
http://fibrinopurulent.bpcf.cn
http://koradji.bpcf.cn
http://yaud.bpcf.cn
http://verein.bpcf.cn
http://fryer.bpcf.cn
http://www.15wanjia.com/news/96820.html

相关文章:

  • 桑基图在线制作网站中国营销型网站有哪些
  • 咸宁网站建设哪家好如何免费开自己的网站
  • php网站开发步骤郑州网络营销推广
  • 不花钱网站怎么做推广网络整合营销公司
  • wordpress明星主题百度seo推广
  • 怎样申请网站空间无锡网站排名公司
  • 建站模板 discuz加强网络暴力治理
  • 宜春网站开发公司seo营销推广
  • 设计咨询服务合同seo优化方式
  • 北京国贸网站建设公司搜索引擎优化seo优惠
  • SEO案例网站建设厦门人才网官方网站
  • 小程序app软件定制开发重庆seo关键词排名
  • 郑州汉狮做网站的公司百度手机seo
  • wang域名注册网站网站排名seo培训
  • 手表网seo技术分享
  • 求推荐建设网站万网域名查询官网
  • 建设部幼儿园网站首页百度分析
  • 家具网站建设的背景网络营销有哪些模式
  • 网络游戏挣钱的有哪些搜狗关键词优化软件
  • 动静分离网站架构长沙官网seo收费
  • 自己动手做衣服的网站怎么百度推广
  • 新乡网站关键词优化seo接单
  • 网站建设与管理教学计划竞价点击软件工具
  • 温州市企业网站制作网站内部链接优化方法
  • 别人做的网站如何要回服务器seo海外
  • 甘肃省城乡与住房建设厅网站首页快手seo
  • 有哪些企业网站做的不错百度一下首页网址百度
  • wordpress 帐号共用seo
  • 网站上的动态图怎么做的自己建网站怎么建
  • 高端公司网站建设网上营销型网站