I need to encrypt or decrypt a string
Do you need something standard, or just something simple that you can easily implement in a variety of languages and dialects?
Bear in mind that any encryption that uses a key (or passkey or password) is only going to be as strong as your ability to keep people from disassembling your program.
In fact, something you code yourself that isn't a standard encryption, has some added "security by obscurity".
You could, for example, use the sequence X(I + 1) = (X(I) * 17 + 31) Mod 8192 to generate a pseudo-random sequence of integers 0..8191, and then use Bit.And(X(I), 0xFF) to turn that into a pseudo-random sequence of bytes 0..255, and then use that as a cipher-pad.
In fact, if you start the sequence off with today's date eg X(0) = 20250309 Mod 8192 then you've got yourself a one-time cipher pad for each day.
Add some random salt and do the Xoring progressively and you've got something strong enough for our usual humble purposes.
Still crackable by somebody who can disassemble your program, though, but like I noted above, so is any method that uses a shared secret.
There is the small problem that the above sequence repeats after 8192 items, but as long as your messages are shorter than that... no problem. And if they're longer, well, it's still hard to crack, just less hard. Or we can find a longer sequence: I chose the above sequence because it fits easily inside 32-bit math, but is no problem to find a longer one like eg X(I + 1) = (X(I) * 153 + 160) Mod 0x40000 which give you a sequence of 262144 pseudo-random numbers.