Dagger
Search

random

No long description provided.

Installation

dagger install github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9

Entrypoint

Return Type
Random
Example
dagger -m github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9 call \
func (m *MyModule) Example() *dagger.Random  {
	return dag.
			Random()
}
@function
def example() -> dagger.Random:
	return (
		dag.random()
	)
@func()
example(): Random {
	return dag
		.random()
}

Types

Random 🔗

Random provides functions for generating random values such as UUIDs and random-derived SHA hashes. Each call returns a fresh value; results are not cached by the Dagger engine.

serial() 🔗

Serial generates a random n-byte X.509 serial number and returns it as a lowercase hexadecimal string (n*2 chars). The default n=16 yields a 128-bit serial, which is the recommended size for newly issued certificates. The low bit is forced to 1 so the value is always non-zero (an all-zero output, while astronomically unlikely from crypto/rand, would be rejected by consumers that require a positive integer such as crypto/x509). ASN.1 INTEGER sign encoding is x509’s responsibility and is unaffected by this adjustment.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
nInteger !16No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9 call \
 serial --n integer
func (m *MyModule) Example(ctx context.Context, n int) string  {
	return dag.
			Random().
			Serial(ctx, n)
}
@function
async def example(n: int) -> str:
	return await (
		dag.random()
		.serial(n)
	)
@func()
async example(n: number): Promise<string> {
	return dag
		.random()
		.serial(n)
}

sha256() 🔗

Sha256 generates a random n-byte value and returns its SHA-256 hash as a hexadecimal string.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
nInteger !32No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9 call \
 sha-2-5-6 --n integer
func (m *MyModule) Example(ctx context.Context, n int) string  {
	return dag.
			Random().
			Sha256(ctx, n)
}
@function
async def example(n: int) -> str:
	return await (
		dag.random()
		.sha256(n)
	)
@func()
async example(n: number): Promise<string> {
	return dag
		.random()
		.sha256(n)
}

sha512() 🔗

Sha512 generates a random n-byte value and returns its SHA-512 hash as a hexadecimal string.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
nInteger !64No description provided
Example
dagger -m github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9 call \
 sha-5-1-2 --n integer
func (m *MyModule) Example(ctx context.Context, n int) string  {
	return dag.
			Random().
			Sha512(ctx, n)
}
@function
async def example(n: int) -> str:
	return await (
		dag.random()
		.sha512(n)
	)
@func()
async example(n: number): Promise<string> {
	return dag
		.random()
		.sha512(n)
}

uuidV4() 🔗

UuidV4 generates a random UUID version 4 and returns it as a string.

Return Type
String !
Example
dagger -m github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9 call \
 uuid-v-4
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Random().
			UuidV4(ctx)
}
@function
async def example() -> str:
	return await (
		dag.random()
		.uuid_v4()
	)
@func()
async example(): Promise<string> {
	return dag
		.random()
		.uuidV4()
}

uuidV7() 🔗

UuidV7 generates a random UUID version 7 and returns it as a string.

Return Type
String !
Example
dagger -m github.com/z5labs/devex/daggerverse/random@d38cd46573b89a2722fb888c91ced6495d6825e9 call \
 uuid-v-7
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Random().
			UuidV7(ctx)
}
@function
async def example() -> str:
	return await (
		dag.random()
		.uuid_v7()
	)
@func()
async example(): Promise<string> {
	return dag
		.random()
		.uuidV7()
}