{ "version": "https://jsonfeed.org/version/1.1", "user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL -- https://matoken.org/blog/tag/sha512/feed/json/ -- and add it your reader.", "home_page_url": "https://matoken.org/blog/tag/sha512/", "feed_url": "https://matoken.org/blog/tag/sha512/feed/json/", "language": "ja", "title": "sha512 – matoken's blog", "description": "Is there no plan B?", "icon": "https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9.jpeg", "items": [ { "id": "http://matoken.org/blog/?p=2318", "url": "https://matoken.org/blog/2019/03/15/generate-a-sha512-password-with-openssl/", "title": "OpenSSL\u3067SHA512\u306ePASSWORD\u3092\u751f\u6210\u3059\u308b", "content_html": "
Linux \u306e /etc/shadow \u306esha512\u5f62\u5f0f\u306e\u6697\u53f7\u5316\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u751f\u6210\u3059\u308b\u306e\u306b OpenSSL \u3092\u5229\u7528\u3057\u305f\u30e1\u30e2\u3067\u3059\uff0e
\n\u6700\u8fd1\u306f SHA512 \u304c\u898f\u5b9a\u5024\u306b\u306a\u3063\u3066\u3044\u308b
\n$ grep ^ENCRYPT_METHOD /etc/login.defs\r\nENCRYPT_METHOD SHA512\n
openssl passwd \u306f 1.1.1 \u304b\u3089 sha512 \u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b
\n*) 'openssl passwd' can now produce SHA256 and SHA512 based output,\n
-6 \u30aa\u30d7\u30b7\u30e7\u30f3\u304c SHA512
\n$ openssl version\r\nOpenSSL 1.1.1a 20 Nov 2018 (Library: OpenSSL 1.1.1b 26 Feb 2019)\r\n$ openssl passwd --help\r\nUsage: passwd [options]\r\nValid options are:\r\n -help Display this summary\r\n -in infile Read passwords from file\r\n -noverify Never verify when reading password from terminal\r\n -quiet No warnings\r\n -table Format output as table\r\n -reverse Switch table columns\r\n -salt val Use provided salt\r\n -stdin Read passwords from stdin\r\n -6 SHA512-based password algorithm\r\n -5 SHA256-based password algorithm\r\n -apr1 MD5-based password algorithm, Apache variant\r\n -1 MD5-based password algorithm\r\n -aixmd5 AIX MD5-based password algorithm\r\n -crypt Standard Unix password algorithm (default)\r\n -rand val Load the file(s) into the random number generator\r\n -writerand outfile Write random data to the specified file\n
\u3053\u3093\u306a\u611f\u3058\u3067\u4f5c\u308c\u308b
\n$ \u304c\u533a\u5207\u308a\u6587\u5b57\u306b\u306a\u3063\u3066\u3044\u3066\uff0c 6 \u90e8\u5206\u304c\u6697\u53f7\u5f62\u5f0f\u306eid\uff0cSALT \u90e8\u5206\u304csalt\uff0c\u305d\u306e\u5f8c\u308d\u304c\u6697\u53f7\u5316\u30d1\u30b9\u30ef\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b
$ openssl passwd -salt SALT -6 PASSWORD\r\n$6$SALT$io0TPmhM8ythCm7Idt0AfYvTuFCLyA1CMVmeT3EUqarf2NQcTuLKEgP9.4Q8fgClzP7OCnyOY1wo1xDw0jtyH1\n
\u3053\u306e\u6587\u5b57\u5217\u3092\uff0c /etc/shadow \u306e\u7b2c2\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u57cb\u3081\u8fbc\u3080\u3068login \u306b\u5229\u7528\u3067\u304d\u308b
\nSALT \u3082\u30e9\u30f3\u30c0\u30e0\u306b\u3057\u305f\u3044\u5834\u5408\u306f\uff0c
\n/dev/random \u3084
$ tr -cd '[:alnum:]' < /dev/random | head -c 8\r\nouOpUJoq\n
openssl rand \u304c\u4f7f\u3048\u308b
\n$ openssl rand --help\r\nUsage: rand [flags] num\r\nValid options are:\r\n -help Display this summary\r\n -out outfile Output file\r\n -rand val Load the file(s) into the random number generator\r\n -writerand outfile Write random data to the specified file\r\n -base64 Base64 encode output\r\n -hex Hex encode output\r\n -engine val Use engine, possibly a hardware device\r\n$ openssl rand -base64 6\r\nGy/YhLzM\n
salt 8 \u6587\u5b57\u3067 sha512 \u306a\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u4f5c\u6210
\n$ openssl passwd -6 -salt $(openssl rand -base64 6) PASSWORD\r\n$6$O2bwYkq/$QIIeAsVueV3vfGZqK/obGMevpB3DwRb/wq2uqn3ykdst1hEV3.72cGPu3gX0p3mD5KPWNrK0M6OPdElDPGD000\n
\u5b9f\u969b\u306b /etc/shadow \u306b\u8a2d\u5b9a\u3057\u3066\u8a8d\u8a3c\u3092\u8a66\u3057\u3066\u307f\u308b
\n$ sudo useradd testuser\r\n$ sudo sed -i 's,^testuser:[^:]*,testuser:$6$O2bwYkq/$QIIeAsVueV3vfGZqK/obGMevpB3DwRb/wq2uqn3ykdst1hEV3.72cGPu3gX0p3mD5KPWNrK0M6OPdElDPGD000,' /etc/shadow\r\n$ sudo grep ^testuser: /etc/shadow\r\ntestuser:$6$O2bwYkq/$QIIeAsVueV3vfGZqK/obGMevpB3DwRb/wq2uqn3ykdst1hEV3.72cGPu3gX0p3mD5KPWNrK0M6OPdElDPGD000:17970:0:99999:7:::\r\n$ su testuser\r\nPassword:\r\n$ whoami\r\ntestuser\r\n$\n
openssl \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u53e4\u304f\u3066SHA512\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u9069\u5f53\u306ascript\u3067\u751f\u6210\u3067\u304d\u308b
\nsalt \u3092\u540c\u3058\u3082\u306e\u306b\u3057\u3066\u8a66\u3059\u3068\u540c\u3058\u6587\u5b57\u5217\u304c\u5f97\u3089\u308c\u308b\u306e\u304c\u78ba\u8a8d\u3067\u304d\u308b
$ perl -e 'print crypt(\"PASSWORD\", ( \"\\$6\\$\" . \"O2bwYkq/\" ));'\r\n$6$O2bwYkq/$QIIeAsVueV3vfGZqK/obGMevpB3DwRb/wq2uqn3ykdst1hEV3.72cGPu3gX0p3mD5KPWNrK0M6OPdElDPGD000\r\n$ python -c \"import crypt, getpass, pwd; print crypt.crypt('PASSWORD','\\$6\\$O2bwYkq/\\$')\"\r\n$6$O2bwYkq/$QIIeAsVueV3vfGZqK/obGMevpB3DwRb/wq2uqn3ykdst1hEV3.72cGPu3gX0p3mD5KPWNrK0M6OPdElDPGD000\n\u74b0\u5883
\n$ dpkg-query -W openssl login\r\nlogin 1:4.5-1.1\r\nopenssl 1.1.1a-1\r\n$ lsb_release -dr\r\nDescription: Debian GNU/Linux buster/sid\r\nRelease: testing\r\n$ uname -m\r\naarch64\n
\u53c2\u8003URL
\n