I'm working on a portion of the codes to encrypt the ATM card of the user.I came across with an ATM encryption algorithm from the internet


First time PIN generation:
Imagine your card number is 4129123456784321.
There is a cryptographic function f and a key k so that
f(4129123456784321, k) = 9876543212345678
The function f and key k are known to the ATM PIN machine.
The ATM PIN machine choses a random pin, lets say 1234.
Then the ATM PIN machine takes the first 4 characters of the encrypted number (9876), subtracts your chosen pin (1234), and stores the result (8642) in the ATM server. This is known as the pin offset.
The ATM PIN machine prints 1234 into your pin mailer using an attached printer.

The problem is most of the encryption of the Java security is generate a byte value as a result of the encryption. I wonder is there any method to implement the "f(4129123456784321, k) = 9876543212345678" ?