I know there are some encrypting algorithm that once the text (the message) is encrypted there is no way to decrypt it.
I can think one way of doing this: using as encryption key the current date at the encryption moment. But there is one problem wiht that: Each time you encrypt the same message the result will be different.
I think there must be some "math-algorithm" to encrypt without out the posibility to decrypt and that always the same message turns out with the same encrypted message, but I realy can't imagine how to do it.
Note: I'm posting this question in this forum and not in stackoverflow.com intentionally, it is not referred to "how to programm the algorithm", it is refered to "how is the math algorithm".
Such algorithms do exist. Which one you mean depends on what you mean by "no way to decrypt it". You refer to either:
Edited in because this is probably too long for comments:
Diego, no problem. They're not, as they're two different things and you're comparing apples and oranges, so to speak. A cryptosystem is designed to be hard to undo without the key, but easy if you have the key. By contrast, a hashing function should only require 1 input, be one way and give a unique output for each input. The idea is to be able to generate a unique representation of the output without being able to deduce what the output is. Why?
Well aside from verifying the unique nature of your input, a hashing function is used as part of a digital signature. In a public key cryptosystem, you may well be aware that Alice can send Bob an encrypted message using Bob's public key. However, anyone can send Bob a message using Bob's public key. If Eve has broken the cryptosystem, she could intercept Alice's message, decrypt it, change it, re-encrypt it and send it on to Bob.
How do we prevent this? Well, let $H: x\rightarrow y$ be a map from $x$ some input to $y$ some output. It is trivial to compute $H$ but impossible (ideally, the truth is just very very unlikely) to compute $H^{-1}$.
Then let $C:x,k$ be some assymetric cryptosystem Alice and Bob know, with Alice's keys $a_p$ and $a_s$ (public and secret) and likewise Bob's keys $b_p$ and $b_s$.
Now we know that as this cryptosystem is assymetric, that $C:x,b_p \rightarrow z$ where $z$ is some ciphertext (encrypted secret) and that $C:z,b_s \rightarrow x$ i.e. if you use Bob's public key to encrypt, Bob's private key using exactly the same algorithm will decrypt the process.
This we know already. However, as discussed, a man in the middle attack is possible if Eve knows Bob's secret. However, Alice can do two things:
And send the second one to Bob. What's the point in this? Well, Bob can reverse both "encryptions", because he holds the opposite keys (his own private and Alice's public. He is left with two things: the ciphertext and a unique hash of the ciphertext. He can also compute H(x) and compare results. If they differ, he knows the message has been tampered with.
Why? Well, consider Eve sat gleefully with Bob's keys. She intercept's Alices message and sees it contains the two parts (she can decrypt the outer layer, Bob's message). However, now she's left with an impossible situation. She can compute the hash of her newly inserted message, but she does not know Alice's private key (if she does, the cryptosystem is truly broken). Therefore she cannot encrypt the new hash. So, if she tries to send the new message onwards, Bob will immediately be aware the system has been tampered with.
This is called a digital signature or digitally signing and is used to identify the message author as who they truly say they are. After all, only they can encrypt with their private key (allegedly). The importance of hashing in this scenario is that it generates a unique output for each given output. However, not being reversible is also desired so that it is impossible to determine what a secret is given the output. This also makes it a highly used password-storage mechanism (because in theory, you're not storing the passwords, just a unique representation of them).
As always in cryptography, someone is always trying to break hash functions. Rainbow tables are the technique used to pre-compute parts of hashes to make hash reversing easier. Note however that the longer the input, the larger the tables need to be. Hence why passwords should always be greater than 6 characters...
Finally, you may be interested to know in Hash weaknesses. If two hashes with unique input produce the same output, this is called a collision and is a serious weakness, especially if someone can work out any pattern to said collisions. MD5 is thought to suffer from some, as is SHA1. SHA2 may, also. In any case, NIST has launched SHA-3, a competition to find future hash functions offering security now and in many years to come. The finalists are available to view here.