~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Drizzle Client & Protocol Library
 *
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
 * All rights reserved.
 *
 * Use and distribution licensed under the BSD license.  See
 * the COPYING.BSD file in the root source directory for full text.
 */

#include "config.h"

#include <stdio.h>
#include <string.h>

#include <libdrizzle/drizzle_client.h>

#define BUFFER_CHUNK 8192

int main(int argc, char *argv[])
{
  char hashed_password[DRIZZLE_MYSQL_PASSWORD_HASH];

  if (argc != 2)
  {
    printf("Usage: %s <password to hash>\n", argv[0]);
    return 1;
  }

  drizzle_mysql_password_hash(hashed_password, argv[1], strlen(argv[1]));

  printf("%s\n", hashed_password);

  return 0;
}