seed command


The SEED is a widely-used crypto specification in South Korea made by the KISA. There are ECB and CBC methods in the SEED.

The following is an explanation to encrypt/decrypt data with the ECB.

This command is for initializing PHPoC's SEED crypto engine. So this command should be executed prior to the encryption/decryption operation. This command returns a context which is used for encryption and decryption.

Parameter Description
enc/dec enc - encryption
dec - decryption
$ecb_key the 128/256 bits key to used in encryption and decryption


The SEED encryption or decryption is performed with this command according to the initialization command. It returns the data which was encrypted or decrypted.

Parameter Description
$seed the context when the crypto engine was initialized
$text plain text to be encrypted or cipher text to be decrypted


The following is an explanation to encrypt/decrypt data with the CBC.

This command is for initializing PHPoC's SEED crypto engine. So this command should be executed prior to the encryption/decryption. This command returns a context which is used for encryption and decryption.

Parameter Description
$enc/dec enc - encryption
dec - decryption
$cbc_key the 128/256 bits key to be used in encryption and decryption
$iv 128 bits initialization vector


The SEED encryption or decryption is performed with this command according to the initialization command. It returns the data which was encrypted or decrypted.

Parameter Description
$seed the context when the crypto engine was initialized
$text plain text to be encrypted or cipher text to be decrypted


The following is an example of the CBC-based SEED encryption and decryption.

// encryption
$seed = system("seed init cbc enc %1 %2", $cbc_key, $cbc_iv);
$out = system("seed crypt %1 %2", $seed, $cbc_pt32);

// decryption
$seed = system("seed init cbc dec %1 %2", $cbc_key, $cbc_iv);
$out = system("seed crypt %1 %2", $seed, $cbc_ct32);