Definition at line 248 of file uuid-ossp.c.
260 #ifdef HAVE_UUID_E2FS
263 uuid_generate_time(uu);
264 uuid_unparse(uu, strbuf);
271 if (ptr &&
len <= 36)
272 strcpy(strbuf + (36 -
len), ptr);
275 uint32_t
status = uuid_s_ok;
278 uuid_create(&uu, &
status);
292 if (ptr &&
len <= 36)
293 strcpy(strbuf + (36 -
len), ptr);
301 (
errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
302 errmsg(
"uuid library failure: %d",
313 uint32_t
status = uuid_s_ok;
322 elog(
ERROR,
"could not initialize %s context: %s",
"MD5",
326 elog(
ERROR,
"could not update %s context: %s",
"MD5",
331 elog(
ERROR,
"could not finalize %s context: %s",
"MD5",
341 elog(
ERROR,
"could not initialize %s context: %s",
"SHA1",
345 elog(
ERROR,
"could not update %s context: %s",
"SHA1",
348 elog(
ERROR,
"could not finalize %s context: %s",
"SHA1",
352 memcpy(&uu, sha1result,
sizeof(uu));
359 #ifdef HAVE_UUID_E2FS
362 uuid_unparse((
unsigned char *) &uu, strbuf);
374 (
errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION),
375 errmsg(
"uuid library failure: %d",
384 #ifdef HAVE_UUID_E2FS
387 uuid_generate_random(uu);
388 uuid_unparse(uu, strbuf);
391 "%08lx-%04x-%04x-%04x-%04x%08lx",
392 (
unsigned long) arc4random(),
393 (
unsigned) (arc4random() & 0xffff),
394 (
unsigned) ((arc4random() & 0xfff) | 0x4000),
395 (
unsigned) ((arc4random() & 0x3fff) | 0x8000),
396 (
unsigned) (arc4random() & 0xffff),
397 (
unsigned long) arc4random());
int pg_cryptohash_update(pg_cryptohash_ctx *ctx, const uint8 *data, size_t len)
int pg_cryptohash_init(pg_cryptohash_ctx *ctx)
void pg_cryptohash_free(pg_cryptohash_ctx *ctx)
pg_cryptohash_ctx * pg_cryptohash_create(pg_cryptohash_type type)
int pg_cryptohash_final(pg_cryptohash_ctx *ctx, uint8 *dest, size_t len)
const char * pg_cryptohash_error(pg_cryptohash_ctx *ctx)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define DirectFunctionCall1(func, arg1)
static void static void status(const char *fmt,...) pg_attribute_printf(1
size_t strlcpy(char *dst, const char *src, size_t siz)
#define CStringGetDatum(X)
#define SHA1_DIGEST_LENGTH
#define UUID_V3_OR_V5(uu, v)
#define UUID_TO_LOCAL(uu)
#define UUID_TO_NETWORK(uu)
Datum uuid_in(PG_FUNCTION_ARGS)
References CStringGetDatum, dce_uuid_t, DirectFunctionCall1, elog, ereport, errcode(), errmsg(), ERROR, free, len, pg_cryptohash_create(), pg_cryptohash_error(), pg_cryptohash_final(), pg_cryptohash_free(), pg_cryptohash_init(), pg_cryptohash_update(), PG_MD5, PG_SHA1, SHA1_DIGEST_LENGTH, snprintf, status(), generate_unaccent_rules::str, strlcpy(), uuid_in(), UUID_TO_LOCAL, UUID_TO_NETWORK, and UUID_V3_OR_V5.
Referenced by uuid_generate_v1(), uuid_generate_v1mc(), uuid_generate_v3(), uuid_generate_v4(), uuid_generate_v5(), uuid_nil(), uuid_ns_dns(), uuid_ns_oid(), uuid_ns_url(), and uuid_ns_x500().