異なる文字セットエンコーダを試して、その違いを確認できます。出力され
import javax.xml.bind.DatatypeConverter;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
String s = "ü";
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
for (Map.Entry<String, Charset> entry : Charset.availableCharsets().entrySet()) {
try {
byte[] encoded = s.getBytes(entry.getValue());
byte[] digest = sha1.digest(encoded);
System.out.printf("For encoding %s, SHA1 hash is %s%n",
entry.getKey(), DatatypeConverter.printHexBinary(digest));
} catch (UnsupportedOperationException e) {
System.out.printf("Cant make it work for %s%n", entry.getKey());
}
}
}
}
は私のMACに:言及された他の回答として
For encoding Big5, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding Big5-HKSCS, SHA1 hash is BB4DF74228C74A9F5B1CFADC9A711AFC3ACAC72E
For encoding CESU-8, SHA1 hash is 94A759FD37735430753C7B6B80684306D80EA16E
For encoding EUC-JP, SHA1 hash is 351B74F9485AEACE9E1F18FA834C01BBD95AEFFE
For encoding EUC-KR, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding GB18030, SHA1 hash is 8423E79957EB24D34D202D200DC8172062B09BC9
For encoding GB2312, SHA1 hash is 8423E79957EB24D34D202D200DC8172062B09BC9
For encoding GBK, SHA1 hash is 8423E79957EB24D34D202D200DC8172062B09BC9
For encoding IBM-Thai, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM00858, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM01140, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM01141, SHA1 hash is 655F2B71DDFAFBCBD5AF517F02EB9386A2A7A2A1
For encoding IBM01142, SHA1 hash is EB6B0E7165A8118B4BD2DE93FBE8182DC50FE8DE
For encoding IBM01143, SHA1 hash is EB6B0E7165A8118B4BD2DE93FBE8182DC50FE8DE
For encoding IBM01144, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM01145, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM01146, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM01147, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM01148, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM01149, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM037, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM1026, SHA1 hash is C2204EDBFB1B72C9E996A5E6464F6AB0198C494F
For encoding IBM1047, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM273, SHA1 hash is 655F2B71DDFAFBCBD5AF517F02EB9386A2A7A2A1
For encoding IBM277, SHA1 hash is EB6B0E7165A8118B4BD2DE93FBE8182DC50FE8DE
For encoding IBM278, SHA1 hash is EB6B0E7165A8118B4BD2DE93FBE8182DC50FE8DE
For encoding IBM280, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM284, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM285, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM290, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM297, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM420, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM424, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM437, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM500, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM775, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM850, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM852, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM855, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM857, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM860, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM861, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM862, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM863, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM864, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM865, SHA1 hash is A3F294235FE5422005AE9BC3A0D1BFFE12CFE353
For encoding IBM866, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM868, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM869, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding IBM870, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM871, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding IBM918, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
Cant make it work for ISO-2022-CN
For encoding ISO-2022-JP, SHA1 hash is EEFF680379A9FC2E2328A673C1C9A9488027DDE6
For encoding ISO-2022-JP-2, SHA1 hash is 7F2ABFCFEE137EAF0E691FF15303B2E49FA2F10F
For encoding ISO-2022-KR, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding ISO-8859-1, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding ISO-8859-13, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding ISO-8859-15, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding ISO-8859-2, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding ISO-8859-3, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding ISO-8859-4, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding ISO-8859-5, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding ISO-8859-6, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding ISO-8859-7, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding ISO-8859-8, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding ISO-8859-9, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding JIS_X0201, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding JIS_X0212-1990, SHA1 hash is 1636827A2EED870EE75B8646595EA7FA833B7B2D
For encoding KOI8-R, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding KOI8-U, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding Shift_JIS, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding TIS-620, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding US-ASCII, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding UTF-16, SHA1 hash is 884B39989F49BC0C3B4095E564B97F788E8F26A4
For encoding UTF-16BE, SHA1 hash is 4BB28530F49234022C33A9A53020019FF1729128
For encoding UTF-16LE, SHA1 hash is A497384499A29B7E56BEC88F64915F8697B9F212
For encoding UTF-32, SHA1 hash is 2D15E32FE6E8B72CC758BF92826781A21F543F06
For encoding UTF-32BE, SHA1 hash is 2D15E32FE6E8B72CC758BF92826781A21F543F06
For encoding UTF-32LE, SHA1 hash is 42670183E5B0D4ED60120ABB18E4B19458B8786D
For encoding UTF-8, SHA1 hash is 94A759FD37735430753C7B6B80684306D80EA16E
For encoding windows-1250, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding windows-1251, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding windows-1252, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding windows-1253, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding windows-1254, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding windows-1255, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding windows-1256, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding windows-1257, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding windows-1258, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding windows-31j, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-Big5-HKSCS-2001, SHA1 hash is BB4DF74228C74A9F5B1CFADC9A711AFC3ACAC72E
For encoding x-Big5-Solaris, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-COMPOUND_TEXT, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding x-euc-jp-linux, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-EUC-TW, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-eucJP-Open, SHA1 hash is 351B74F9485AEACE9E1F18FA834C01BBD95AEFFE
For encoding x-IBM1006, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1025, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1046, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1097, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1098, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1112, SHA1 hash is 5FB9A0BA37519B7FD51909C778EE3B48502DE7C1
For encoding x-IBM1122, SHA1 hash is EB6B0E7165A8118B4BD2DE93FBE8182DC50FE8DE
For encoding x-IBM1123, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1124, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1166, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM1364, SHA1 hash is 7A81AF3E591AC713F81EA1EFE93DCF36157D8376
For encoding x-IBM1381, SHA1 hash is 8423E79957EB24D34D202D200DC8172062B09BC9
For encoding x-IBM1383, SHA1 hash is 8423E79957EB24D34D202D200DC8172062B09BC9
For encoding x-IBM300, SHA1 hash is 0AD631FE7C0AFBB8E46DFF643ECB6F157F0F17C2
For encoding x-IBM33722, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM737, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM833, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM834, SHA1 hash is BF465657E801DC6DEC070496C4CD3BE6C9463310
For encoding x-IBM856, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM874, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM875, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM921, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding x-IBM922, SHA1 hash is AB461F6B8A6842A473257A2561C1FBDF91BDFE77
For encoding x-IBM930, SHA1 hash is 7A81AF3E591AC713F81EA1EFE93DCF36157D8376
For encoding x-IBM933, SHA1 hash is 7A81AF3E591AC713F81EA1EFE93DCF36157D8376
For encoding x-IBM935, SHA1 hash is CC6D81CF2D2718EEBE6B8AAC261DF04090159565
For encoding x-IBM937, SHA1 hash is 7A81AF3E591AC713F81EA1EFE93DCF36157D8376
For encoding x-IBM939, SHA1 hash is 7A81AF3E591AC713F81EA1EFE93DCF36157D8376
For encoding x-IBM942, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM942C, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM943, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM943C, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM948, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM949, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM949C, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM950, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM964, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-IBM970, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-ISCII91, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-ISO-2022-CN-CNS, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-ISO-2022-CN-GB, SHA1 hash is 187F00566A714B33F37B77D53ECA6E20CD74DDE0
For encoding x-iso-8859-11, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-JIS0208, SHA1 hash is 3A2C82466E34A4A1677205899068A2D53A92BD54
Cant make it work for x-JISAutoDetect
For encoding x-Johab, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-MacArabic, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacCentralEurope, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacCroatian, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacCyrillic, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-MacDingbat, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-MacGreek, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacHebrew, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacIceland, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacRoman, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacRomania, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacSymbol, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-MacThai, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-MacTurkish, SHA1 hash is F195C020A28DFC5F2FB6AF256B524DDCD93756ED
For encoding x-MacUkraine, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-MS932_0213, SHA1 hash is 9B4A2DBFED88AFE0BD16BD7CAD69F90BE5A09FAF
For encoding x-MS950-HKSCS, SHA1 hash is BB4DF74228C74A9F5B1CFADC9A711AFC3ACAC72E
For encoding x-MS950-HKSCS-XP, SHA1 hash is BB4DF74228C74A9F5B1CFADC9A711AFC3ACAC72E
For encoding x-mswin-936, SHA1 hash is 8423E79957EB24D34D202D200DC8172062B09BC9
For encoding x-PCK, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-SJIS_0213, SHA1 hash is 9B4A2DBFED88AFE0BD16BD7CAD69F90BE5A09FAF
For encoding x-UTF-16LE-BOM, SHA1 hash is 61FB9BF626098B2786735AA4505430890DCC6BC8
For encoding X-UTF-32BE-BOM, SHA1 hash is 0662CE1CEA946124D3FA5F43B4BA2DA41CEF500C
For encoding X-UTF-32LE-BOM, SHA1 hash is A6030F4A113F71489180D342DDB5106CE9FC33E5
For encoding x-windows-50220, SHA1 hash is 7F2ABFCFEE137EAF0E691FF15303B2E49FA2F10F
For encoding x-windows-50221, SHA1 hash is 7F2ABFCFEE137EAF0E691FF15303B2E49FA2F10F
For encoding x-windows-874, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-windows-949, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-windows-950, SHA1 hash is 5BAB61EB53176449E25C2C82F172B82CB13FFB9D
For encoding x-windows-iso2022jp, SHA1 hash is EEFF680379A9FC2E2328A673C1C9A9488027DDE6
ハッシュ関数は、通常、文字ではなく*バイト*で動作します。 –
@OliverCharlesworthまあ、私の質問はまだ有効です。バイト数は、16進ではなくバイナリで表現されます。 –
私が言っていることは、ハッシュ関数があなたが使っていた文字セットを知らない、または気にしないことです。 –