Fortinet white logo
Fortinet white logo

Script Reference Guide

G2F(alg, key)

G2F(alg, key)

Returns a G2F random value.

Syntax

G2F(alg, key);

Arguments

Name Description

alg

A string which specifies the algorithm.

key

A string which is a secret key.

Events

Applicable in all events.

Example

when HTTP_REQUEST {
alg = "MD5"; -- or "SHA1", "SHA256", "SHA384", "SHA512"
key  = "123456789ABCDEF0123456789ABCDEF\121"; -- or you can generate a key using key_gen
re = G2F(alg, key);
debug("the G2F value is %d\n", re);
}

Note:

Alg: type of hashing algorithms to use, must be MD5, SHA1, SHA256, SHA384, SHA512

Supported Version

FortiADC version 5.2.x and later.

G2F(alg, key)

G2F(alg, key)

Returns a G2F random value.

Syntax

G2F(alg, key);

Arguments

Name Description

alg

A string which specifies the algorithm.

key

A string which is a secret key.

Events

Applicable in all events.

Example

when HTTP_REQUEST {
alg = "MD5"; -- or "SHA1", "SHA256", "SHA384", "SHA512"
key  = "123456789ABCDEF0123456789ABCDEF\121"; -- or you can generate a key using key_gen
re = G2F(alg, key);
debug("the G2F value is %d\n", re);
}

Note:

Alg: type of hashing algorithms to use, must be MD5, SHA1, SHA256, SHA384, SHA512

Supported Version

FortiADC version 5.2.x and later.