承接 tal7aouy/hashlib 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tal7aouy/hashlib

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tal7aouy/hashlib

包简介

Generates strong, secure passwords that are resistant to brute-force attacks.

README 文档

README

The HashLib library provides a convenient and flexible way to generate, hash, and validate passwords with various options and requirements. It includes a trait named Hasher that defines password generation, validation, and requirement checking functionalities.

Table of Contents

  1. Introduction
  2. Installation
  3. Usage
  4. Methods
  5. Conclusion

Introduction

The HashLib library is designed to simplify password hashing and verification in PHP applications. It offers a trait called Hasher that can be easily incorporated into your own classes to handle password-related operations.

Installation

The library can be installed using Composer:

composer require tal7aouy/hashlib

Usage

Basic Hashing

use Tal7aouy\HashLib\HashLib;
$passwordHash = HashLib::getInstance();
$password = "my_secure_password";
$hashedPassword = $passwordHash::hash($password);

if ($passwordHash::verify($password, $hashedPassword)) {
    echo "Password is verified!";
} else {
    echo "Password verification failed.";
}

Hashing with Salt

use Tal7aouy\HashLib\HashLib;
$passwordHash = HashLib::getInstance();

$password = "my_secure_password";
$hashedData = $passwordHash::hashWithSalt($password);

if ($passwordHash::verifyWithSalt($password, $hashedData['hash'], $hashedData['salt'])) {
echo "Password is verified!";
} else {
echo "Password verification failed.";
}

Password Requirement Checking

use Tal7aouy\HashLib\HashLib;

$passwordValidator = HashLib::getInstance();
$passwordValidator->setUseLowerCase(true);
$passwordValidator->setUseUpperCase(true);
$passwordValidator->setUseNumbers(true);
$passwordValidator->setUseSymbols(true);

$password = "Complex@Passw0rd";
$result = $passwordValidator->meetsRequirements($password);

if ($result === true) {
echo "Password meets all requirements.";
} else {
echo "Password requirements not met: " . $result;
}

Methods

For a comprehensive list of methods and their descriptions, please refer to the full documentation.

Below is a quick overview of some of the key methods available in the HashLib library:

setLength

Set the minimum required length for generated passwords.

setUseLowerCase

Specify whether lowercase letters are required in generated passwords.

setUseUpperCase

Specify whether uppercase letters are required in generated passwords.

setUseNumbers

Specify whether numbers are required in generated passwords.

setUseSymbols

Specify whether symbols are required in generated passwords.

setPasswordRequirements

Set multiple password requirements at once.

generateSalt

Generate a random salt using base64 encoding.

isHashed

Check if a password is already hashed.

hash

Hash a password using the specified algorithm and options.

verify

Verify if a password matches a given hash.

hashWithSalt

Hash a password with a randomly generated salt.

verifyWithSalt

Verify if a password, when combined with a salt, matches a given hash.

setPassword

Set the password to be used for hashing and validation.

getPassword

Get the currently set password.

meetsRequirements

Check if a given password meets the specified requirements.

For detailed usage instructions and examples, please see the Usage section above.

conclusion

Version: 1.0.0

License: MIT

For any questions, issues, or feedback, please reach out to the library's author, Mhammed Talhaouy.

tal7aouy/hashlib 适用场景与选型建议

tal7aouy/hashlib 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tal7aouy/hashlib 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tal7aouy/hashlib 我们能提供哪些服务?
定制开发 / 二次开发

基于 tal7aouy/hashlib 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-20