Meet Virtel Maple 3.3.x! Packs, UI, PQCrypto and Fixes.

Download

Data

String Manipulation

Objective: Perform string operations such as concatenation and substring extraction.

Steps:
  • Concatenate strings:
    str add "Hello" " " "World" greeting;
    • "Hello", " ", "World" are the strings to concatenate.
    • "greeting" is the new variable for the result.
  • Extract a substring:
    str cut "0" "5" greeting substring;
    • "0" is the starting index.
    • "5" is the ending index.
    • "greeting" is the source string.
    • "substring" is the new variable for the result.
  • Display the substring:
    csl write substring;

Mathematical Operations

Objective: Perform basic arithmetic operations like addition and multiplication.

Steps:
  • Add numbers:
    mat plus "1" "2" "3" sum;
    • "1", "2", "3" are the numbers to add.
    • "sum" is the new variable for the result.
  • Multiply numbers:
    mat mult "2" "3" "4" product;
    • "2", "3", "4" are the numbers to multiply.
    • "product" is the new variable for the result.
  • Display the results:
    csl write sum; csl write product;

Practical Example

Objective: Create a full name and calculate a total price.

Steps:
  • Create a full name:
    str add "John" " " "Doe" fullName;
  • Extract the first name:
    str cut "0" "4" fullName firstName; csl write firstName;
  • Calculate total price:
    mat mult "10" "2" total; csl write total;

Tips

  • Ensure numbers are passed as strings in math operations.
  • Use str eqs for string comparisons.
  • Apply crt commands for secure data handling.

Conclusion

Data manipulation commands in Virtel Steps, such as str add, mat plus, and bln and, provide essential tools for processing and transforming data.

Commands

str cut

Extracts a substring from a string between specified positions and stores it in a new variable.

str cut (first) (last) (value) (newVarName)
  • first: The starting index (inclusive) (type: VAR).
  • last: The ending index (exclusive) (type: VAR).
  • value: The string to extract from (type: VAR).
  • newVarName: The name of the new variable for the substring (type: VAR).
str cut "0" "5" "Hello World" substring; csl write substring;

This example extracts "Hello" from "Hello World" and prints it.

str add

Concatenates multiple strings into one and stores the result in a new variable.

str add (firstStr) (secondStr) ... (lastStr) (newVarName)
  • firstStr, secondStr, ..., lastStr: The strings to concatenate (type: VAR).
  • newVarName: The name of the new variable for the result (type: VAR).
str add "Hello" " " "World" greeting; csl write greeting;

This example concatenates "Hello", " ", and "World" into "Hello World" and prints it.

str len

Gets the length of a string and stores it in a new variable.

str len (value) (newVarName)
  • value: The string to measure (type: VAR).
  • newVarName: The name of the new variable for the length (type: VAR).
str len "Hello" length; csl write length;

This example gets the length of "Hello" ("5") and prints it.

str get

Gets a character at a specific index in a string and stores it in a new variable.

str get (index) (value) (newVarName)
  • index: The index of the character (type: VAR).
  • value: The string to extract from (type: VAR).
  • newVarName: The name of the new variable for the character (type: VAR).
str get "0" "Hello" firstChar; csl write firstChar;

This example gets "H" from "Hello" and prints it.

str eqs

Checks if two strings are equal and stores the result ("true" or "false") in a new variable.

str eqs (first) (second) (newVarName)
  • first: The first string to compare (type: VAR).
  • second: The second string to compare (type: VAR).
  • newVarName: The name of the new variable for the result (type: VAR).
str eqs "Hello" "Hello" isEqual; csl write isEqual;

This example checks if "Hello" equals "Hello" and prints "true".

str split

Splits a string by a regex pattern and stores the resulting parts in a new list.

str split (regex) (value) (newVarListName)
  • regex: The regex pattern to split by (type: VAR).
  • value: The string to split (type: VAR).
  • newVarListName: The name of the new list for the parts (type: LIST).
str split "," "a,b,c" partsList; lst get partsList "0" firstPart; csl write firstPart;

This example splits "a,b,c" by "," into a list and prints "a".

mat plus

Adds multiple numbers and stores the sum in a new variable.

mat plus (a) (b) ... (lastNum) (newVarName)
  • a, b, ..., lastNum: The numbers to add (type: VAR).
  • newVarName: The name of the new variable for the sum (type: VAR).
mat plus "1" "2" "3" sum; csl write sum;

This example adds 1, 2, and 3, storing "6" in "sum" and printing it.

mat minus

Subtracts numbers from the first one and stores the result in a new variable.

mat minus (a) (b) ... (lastNum) (newVarName)
  • a: The initial number (type: VAR).
  • b, ..., lastNum: The numbers to subtract (type: VAR).
  • newVarName: The name of the new variable for the result (type: VAR).
mat minus "10" "2" "3" result; csl write result;

This example subtracts 2 and 3 from 10, storing "5" in "result" and printing it.

mat mult

Multiplies multiple numbers and stores the product in a new variable.

mat mult (a) (b) ... (lastNum) (newVarName)
  • a, b, ..., lastNum: The numbers to multiply (type: VAR).
  • newVarName: The name of the new variable for the product (type: VAR).
mat mult "2" "3" "4" product; csl write product;

This example multiplies 2, 3, and 4, storing "24" in "product" and printing it.

mat div

Divides the first number by subsequent numbers and stores the result in a new variable.

mat div (a) (b) ... (lastNum) (newVarName)
  • a: The initial number (type: VAR).
  • b, ..., lastNum: The divisors (type: VAR).
  • newVarName: The name of the new variable for the result (type: VAR).
mat div "100" "2" "5" result; csl write result;

This example divides 100 by 2 and then by 5, storing "10" in "result" and printing it.

mat eqs

Checks if two numbers are equal.

mat eqs (a) (b) (newVarName)
  • a: The first number.
  • b: The second number.
  • newVarName: The new variable to store the result (boolean as a string).
var set "5" a; var set "5" b; mat eqs a b isEqual; csl write isEqual;

This example checks if the numbers 5 and 5 are equal, and stores the result in the isEqual variable, which will be "true".

mat grtr

Checks if the first number is greater than the second number.

mat grtr (a) (b) (newVarName)
  • a: The first number.
  • b: The second number.
  • newVarName: The new variable to store the result (boolean as a string).
var set "10" a; var set "5" b; mat grtr a b isGreater; csl write isGreater;

This example checks if 10 is greater than 5, and stores the result in the isGreater variable, which will be "true".

mat less

Checks if the first number is less than the second number.

mat less (a) (b) (newVarName)
  • a: The first number.
  • b: The second number.
  • newVarName: The new variable to store the result (boolean as a string).
var set "5" a; var set "10" b; mat less a b isLess; csl write isLess;

This example checks if 5 is less than 10, and stores the result in the isLess variable, which will be "true".

mat grtreqs

Checks if the first number is greater than or equal to the second number.

mat grtreqs (a) (b) (newVarName)
  • a: The first number.
  • b: The second number.
  • newVarName: The new variable to store the result (boolean as a string).
var set "10" a; var set "5" b; mat grtreqs a b isGreaterOrEqual; csl write isGreaterOrEqual;

This example checks if 10 is greater than or equal to 5, and stores the result in the isGreaterOrEqual variable, which will be "true".

mat lesseqs

Checks if the first number is less than or equal to the second number.

mat lesseqs (a) (b) (newVarName)
  • a: The first number.
  • b: The second number.
  • newVarName: The new variable to store the result (boolean as a string).
var set "5" a; var set "10" b; mat lesseqs a b isLessOrEqual; csl write isLessOrEqual;

This example checks if 5 is less than or equal to 10, and stores the result in the isLessOrEqual variable, which will be "true".

mat random

Generates a random number within a given range.

mat random (min) (max) (newVarName)
  • min: The minimum value.
  • max: The maximum value.
  • newVarName: The new variable to store the result.
mat random 1 10 randomNumber; csl write randomNumber;

This example generates a random number between 1 and 10 and prints it to the console.

mat int

Converts a floating-point number to an integer.

mat int (numberDouble) (newVarName)
  • numberDouble: The floating-point number.
  • newVarName: The new variable to store the result.
var set "5.9" doubleNumber; mat int doubleNumber result; csl write result;

This example converts 5.9 to 5 and stores the result in the result variable.

bln not

Performs a logical "NOT" operation on a boolean value and stores the result in a new variable.

bln not (a) (newVarName)
  • a: The boolean value to negate ("true" or "false") (type: VAR).
  • newVarName: The name of the new variable to store the result (type: VAR).
var set "true" condition; bln not condition negated; csl write negated;

This example negates "true" to "false" and prints the result.

bln and

Performs a logical "AND" operation on two boolean values and stores the result in a new variable.

bln and (a) (b) (newVarName)
  • a: The first boolean value ("true" or "false") (type: VAR).
  • b: The second boolean value ("true" or "false") (type: VAR).
  • newVarName: The name of the new variable to store the result (type: VAR).
bln and "true" "false" result; csl write result;

This example performs "true AND false", storing "false" in "result" and printing it.

bln or

Performs a logical "OR" operation on two boolean values and stores the result in a new variable.

bln or (a) (b) (newVarName)
  • a: The first boolean value ("true" or "false") (type: VAR).
  • b: The second boolean value ("true" or "false") (type: VAR).
  • newVarName: The name of the new variable to store the result (type: VAR).
bln or "true" "false" result; csl write result;

This example performs "true OR false", storing "true" in "result" and printing it.

bln xor

Performs a logical "XOR" operation on two boolean values and stores the result in a new variable.

bln xor (a) (b) (newVarName)
  • a: The first boolean value ("true" or "false") (type: VAR).
  • b: The second boolean value ("true" or "false") (type: VAR).
  • newVarName: The name of the new variable to store the result (type: VAR).
bln xor "true" "true" result; csl write result;

This example performs "true XOR true", storing "false" in "result" and printing it.

crt aes-enc

Encrypts text using AES with a specified key and stores the encrypted result in a new variable.

crt aes-enc (text) (key) (newVarName)
  • text: The text to encrypt (type: VAR).
  • key: The encryption key (type: VAR).
  • newVarName: The name of the new variable to store the encrypted text (type: VAR).
crt aes-enc "Secret message" "myKey123" encrypted; csl write encrypted;

This example encrypts "Secret message" with "myKey123" and prints the encrypted result.

crt aes-dec

Decrypts AES-encrypted text using a specified key and stores the decrypted result in a new variable.

crt aes-dec (text) (key) (newVarName)
  • text: The encrypted text to decrypt (type: VAR).
  • key: The decryption key (type: VAR).
  • newVarName: The name of the new variable to store the decrypted text (type: VAR).
crt aes-enc "Secret message" "myKey123" encrypted; crt aes-dec encrypted "myKey123" decrypted; csl write decrypted;

This example encrypts "Secret message", decrypts it with the same key, and prints "Secret message".

crt base64-enc

Encodes text into Base64 and stores the result in a new variable.

crt base64-enc (text) (newVarName)
  • text: The text to encode (type: VAR).
  • newVarName: The name of the new variable to store the Base64-encoded text (type: VAR).
crt base64-enc "Hello" encoded; csl write encoded;

This example encodes "Hello" into "SGVsbG8=" and prints it.

crt base64-dec

Decodes Base64-encoded text and stores the result in a new variable.

crt base64-dec (text) (newVarName)
  • text: The Base64-encoded text to decode (type: VAR).
  • newVarName: The name of the new variable to store the decoded text (type: VAR).
crt base64-enc "Hello" encoded; crt base64-dec encoded decoded; csl write decoded;

This example encodes "Hello" to Base64, decodes it back, and prints "Hello".

crt hmac-enc

Creates an HMAC (hash-based message authentication code) for text using a key and stores it in a new variable.

crt hmac-enc (text) (key) (newVarName)
  • text: The text to create an HMAC for (type: VAR).
  • key: The key for HMAC generation (type: VAR).
  • newVarName: The name of the new variable to store the HMAC (type: VAR).
crt hmac-enc "Message" "secretKey" hmac; csl write hmac;

This example generates an HMAC for "Message" with "secretKey" and prints it.

crt hmac-ver

Verifies an HMAC for text using a key and stores the result ("true" or "false") in a new variable.

crt hmac-ver (text) (mac) (key) (newVarName)
  • text: The original text (type: VAR).
  • mac: The HMAC to verify (type: VAR).
  • key: The key used for HMAC generation (type: VAR).
  • newVarName: The name of the new variable to store the verification result (type: VAR).
crt hmac-enc "Message" "secretKey" hmac; crt hmac-ver "Message" hmac "secretKey" isValid; csl write isValid;

This example generates an HMAC and verifies it, printing "true" if valid.

crt kem-pair

Generates a key pair for KEM (Key Encapsulation Mechanism) and stores the public and private keys in new variables.

crt kem-pair (publicNewVarName) (privateNewVarName)
  • publicNewVarName: The name of the variable to store the public key (type: VAR).
  • privateNewVarName: The name of the variable to store the private key (type: VAR).
crt kem-pair publicKey privateKey; csl write publicKey;

This example generates a KEM key pair and prints the public key.

crt kem-enc

Encapsulates a shared key using KEM with a public key, storing the ciphertext and shared key in new variables.

crt kem-enc (publicKey) (ciphertextNewVarName) (sharedKeyNewVarName)
  • publicKey: The public key for encapsulation (type: VAR).
  • ciphertextNewVarName: The name of the variable to store the ciphertext (type: VAR).
  • sharedKeyNewVarName: The name of the variable to store the shared key (type: VAR).
crt kem-pair publicKey privateKey; crt kem-enc publicKey ciphertext sharedKey; csl write sharedKey;

This example encapsulates a shared key with a public key and prints the shared key.

crt kem-dec

Decapsulates a shared key using KEM with a private key and ciphertext, storing the shared key in a new variable.

crt kem-dec (ciphertext) (privateKey) (sharedKeyNewVarName)
  • ciphertext: The ciphertext to decapsulate (type: VAR).
  • privateKey: The private key for decapsulation (type: VAR).
  • sharedKeyNewVarName: The name of the variable to store the shared key (type: VAR).
crt kem-pair publicKey privateKey; crt kem-enc publicKey ciphertext sharedKeyEnc; crt kem-dec ciphertext privateKey sharedKeyDec; csl write sharedKeyDec;

This example generates a key pair, encapsulates a key, decapsulates it, and prints the shared key.

crt dsa-pair

Generates a key pair for DSA (Digital Signature Algorithm) and stores the public and private keys in new variables.

crt dsa-pair (publicNewVarName) (privateNewVarName)
  • publicNewVarName: The name of the variable to store the public key (type: VAR).
  • privateNewVarName: The name of the variable to store the private key (type: VAR).
crt dsa-pair publicKey privateKey; csl write publicKey;

This example generates a DSA key pair and prints the public key.

crt dsa-sign

Signs a message using DSA with public and private keys, storing the signature in a new variable.

crt dsa-sign (message) (publicKey) (privateKey) (signatureNewVarName)
  • message: The message to sign (type: VAR).
  • publicKey: The public key (type: VAR).
  • privateKey: The private key (type: VAR).
  • signatureNewVarName: The name of the variable to store the signature (type: VAR).
crt dsa-pair publicKey privateKey; crt dsa-sign "Hello" publicKey privateKey signature; csl write signature;

This example signs "Hello" with DSA keys and prints the signature.

crt dsa-verify

Verifies a DSA signature for a message using a public key, storing the result ("true" or "false") in a new variable.

crt dsa-verify (message) (signature) (publicKey) (newVarName)
  • message: The original message (type: VAR).
  • signature: The signature to verify (type: VAR).
  • publicKey: The public key (type: VAR).
  • newVarName: The name of the variable to store the verification result (type: VAR).
crt dsa-pair publicKey privateKey; crt dsa-sign "Hello" publicKey privateKey signature; crt dsa-verify "Hello" signature publicKey isValid; csl write isValid;

This example signs "Hello", verifies the signature, and prints "true" if valid.

crt sha256

Computes the SHA-256 hash of text and stores it in a new variable.

crt sha256 (text) (newVarName)
  • text: The text to hash (type: VAR).
  • newVarName: The name of the variable to store the hash (type: VAR).
crt sha256 "Hello" hash; csl write hash;

This example computes the SHA-256 hash of "Hello" and prints it (e.g., "a591a6d40bf...").

crt sha512

Computes the SHA-512 hash of text and stores it in a new variable.

crt sha512 (text) (newVarName)
  • text: The text to hash (type: VAR).
  • newVarName: The name of the variable to store the hash (type: VAR).
crt sha512 "Hello" hash; csl write hash;

This example computes the SHA-512 hash of "Hello" and prints it.

crt jwt-enc

Creates a JWT (JSON Web Token) from a payload and secret, storing it in a new variable.

crt jwt-enc (payload) (secret) (newVarName)
  • payload: The data for the token (type: VAR).
  • secret: The secret key for signing (type: VAR).
  • newVarName: The name of the variable to store the JWT (type: VAR).
crt jwt-enc "user:john" "mySecret" token; csl write token;

This example creates a JWT with payload "user:john" and prints it.

crt jwt-ver

Verifies a JWT with a secret key and stores the result ("true" or "false") in a new variable.

crt jwt-ver (token) (secret) (newVarName)
  • token: The JWT to verify (type: VAR).
  • secret: The secret key used for signing (type: VAR).
  • newVarName: The name of the variable to store the verification result (type: VAR).
crt jwt-enc "user:john" "mySecret" token; crt jwt-ver token "mySecret" isValid; csl write isValid;

This example creates a JWT, verifies it, and prints "true" if valid.