Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <iconv.h>
- void print_tripcode (void *job, char *password, char *tripcode)
- {
- iconv_t ic = iconv_open ("UTF8", "SHIFT_JIS");
- char *utf8_password_orig, *utf8_password;
- size_t sjis_pass_len = strlen (password);
- size_t utf8_pass_len = sjis_pass_len * 2;
- utf8_password_orig = utf8_password = malloc (20);
- memset (utf8_password_orig, 0, 20);
- if (iconv (ic, &password, &sjis_pass_len, &utf8_password, &utf8_pass_len) == -1)
- {
- printf ("iconv could not convert password. Error is: %s\n", strerror(errno));
- iconv_close (ic);
- free (utf8_password_orig);
- }
- printf ("%s = %s\n", utf8_password_orig, tripcode);
- iconv_close (ic);
- free (utf8_password_orig);
- }
- int main (void)
- {
- char *sjis_string = malloc (9); // ]髀_]違P
- sjis_string[0] = 0x5D; // this is the Shift-Jis representation of the string on the previous line
- sjis_string[1] = 0xE9;
- sjis_string[2] = 0x8F;
- sjis_string[3] = 0x5F;
- sjis_string[4] = 0x5D;
- sjis_string[5] = 0x88;
- sjis_string[6] = 0xEL;
- sjis_string[7] = 0x50;
- sjis_string[8] = 0x00;
- char *tripcode = "Win/gentoo";
- print_tripcode (NULL, sjis_string, tripcode);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement