{"id":18728275,"url":"https://github.com/worthmine/text-password-automigration","last_synced_at":"2025-04-12T16:33:01.548Z","repository":{"id":56839231,"uuid":"99010463","full_name":"worthmine/Text-Password-AutoMigration","owner":"worthmine","description":"Text::Password::AutoMigration - generate and verify Password with any contexts","archived":false,"fork":false,"pushed_at":"2024-10-17T00:29:04.000Z","size":195,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T01:03:15.310Z","etag":null,"topics":["password-generator","password-hash","perl"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/Text-Password-AutoMigration","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/worthmine.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-01T14:30:20.000Z","updated_at":"2024-10-17T00:29:06.000Z","dependencies_parsed_at":"2023-01-29T00:15:35.426Z","dependency_job_id":null,"html_url":"https://github.com/worthmine/Text-Password-AutoMigration","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worthmine%2FText-Password-AutoMigration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worthmine%2FText-Password-AutoMigration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worthmine%2FText-Password-AutoMigration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worthmine%2FText-Password-AutoMigration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/worthmine","download_url":"https://codeload.github.com/worthmine/Text-Password-AutoMigration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223528519,"owners_count":17160227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["password-generator","password-hash","perl"],"created_at":"2024-11-07T14:20:24.672Z","updated_at":"2024-11-07T14:20:25.296Z","avatar_url":"https://github.com/worthmine.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/worthmine/Text-Password-AutoMigration.svg?branch=main)](https://travis-ci.org/worthmine/Text-Password-AutoMigration)\n# NAME\n\nText::Password::AutoMigration - generate and verify Password with any contexts\n\n# SYNOPSIS\n\n    my $pwd = Text::Password::AutoMigration-\u003enew();\n    my( $raw, $hash ) = $pwd-\u003egenerate();          # list context is required\n    my $input = $req-\u003ebody_parameters-\u003e{passwd};　 # in Plack\n       $input = $req-\u003eparam('passwd');             # in CGI\n       $input = $raw;                              # in CLI\n    my $data = $pwd-\u003eencrypt($input);              # you don't have to care about salt\n    my $flag = $pwd-\u003everify( $input, $data );\n\n# DESCRIPTION\n\nText::Password::AutoMigration is a module for some lasy Administrators.\n\nIt would help you to migrate old hash what has vulnerability\nsuch as encrypted by perl, MD5, SHA-1 or even if it was with SHA-256 to SHA-512.\n\nThe method _verify()_  automatically detects the algorithm which is applied to the hash\nwith **CORE::crypt**, **MD5**, **SHA-1 by hex**, **SHA-256** and of course **SHA-512**.\n\nAnd every _verify()_ **returns a brand new hash** generated by using **with SHA-512**.\n\nTherefore all you have to do is to replace the old hash with the new one on your Databases.\n\n## Constructor and initialization\n\n### new()\n\nNo arguments are required. But you can set some parameters.\n\n- default( _Int_ )\n\n    You can set default length with using 'default' argument like below:\n\n    $pwd = Text::Password::AutoMiglation-\u003enew( default =\u003e 8 );\n\n    It must be an Int, defaults to 10.\n\n- readablity( _Bool_ )\n\n    You can set default strength for password with usnig 'readablity' argument like below:\n\n    $pwd = Text::Password::AutoMiglation-\u003enew( readability =\u003e 0 );\n\n    It must be a Boolean, defaults to 1.\n\n    If it was false, _generate()_ starts to return stronger passwords with charactors hard to read.\n\n- migrate( _Bool_ )\n\n    It must be a Boolean, defaults to 1.\n\n    If you've already replaced all hash or started to make new applications with this module,\n\n    you can call the constructor with _migrate =\u003e 0_.\n\n    Then _verify()_ would not return a new hash but always 1.\n\n    It may help you a little faster without any change of your code.\n\n## Methods and Subroutines\n\n### verify( $raw, $hash )\n\nTo tell the truth, this is the most useful method of this module.\n\nit Returns a true strings instead of boolean if the verification succeeds.\n\nEvery value is **brand new hash from SHA-512**\nbecause it is actually true in Perl anyway.\n\nSo you can replace hash in your Database easily like below:\n\n    my $pwd = Text::Password::AutoMigration-\u003enew();\n\n    my $dbh = DBI-\u003econnect(...);\n    my $db_hash_ref = $dbh-\u003efetchrow_hashref(...);\n    my $param = $req-\u003ebody_parameters;\n\n    my $hash = $pwd-\u003everify( $param-\u003e{passwd} || $raw, $db_hash_ref-\u003e{passwd} );\n    my $verified = length $hash;\n    if ( $verified ) { # don't have to execute it every time\n       my $sth = $dbh-\u003eprepare('UPDATE DB SET passwd=? WHERE uid =?') or die $dbh-\u003eerrstr;\n       $sth-\u003eexcute( $hash, $param-\u003e{uid} ) or die $sth-\u003eerrstr;\n    }\n\nNew hash length is 100 (if it defaults).\nSo you have to change the Table with like below:\n\n    ALTER TABLE User MODIFY passwd VARCHAR(100);\n\n### nonce( _Int_ )\n\ngenerates the random strings with enough strength.\n\nthe length defaults to 10 || $self-\u003edefault().\n\n### encrypt( _Str_ )\n\nreturns hash with unix\\_sha512\\_crypt()\n\nenough strength salts will be made automatically.\n\n### generate( _Int_ )\n\ngenerates pair of new password and its hash.\n\nless readable characters(0Oo1Il|!2Zz5sS$6b9qCcKkUuVvWwXx.,:;~-^'\"\\`) are forbidden\nunless $self-\u003ereadability is 0.\n\nthe length defaults to 10 || $self-\u003edefault().\n\n**DON'T TRUST** this method.\n\nAccording to [Password expert says he was wrong](https://www.usatoday.com/story/news/nation-now/2017/08/09/password-expert-says-he-wrong-numbers-capital-letters-and-symbols-useless/552013001/),\nit's not a safe way. So, I will rewrite this method as soon as I find the better way.\n\n# SEE ALSO\n\n- [GitHub](https://github.com/worthmine/Text-Password-AutoMigration)\n- [CPAN](http://search.cpan.org/perldoc?Text%3A%3APassword%3A%3AAutoMigration)\n- [https://shattered.io/](https://shattered.io/)\n\n# LICENSE\n\nCopyright (C) Yuki Yoshida(worthmine).\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nYuki Yoshida \u003cworthmine@users.noreply.github.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworthmine%2Ftext-password-automigration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworthmine%2Ftext-password-automigration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworthmine%2Ftext-password-automigration/lists"}