cryptography

Is this a known DES cipher? What DES cipher is it? DES-CTR?

import Crypto.Cipher.DES import struct def rol32(x, y): ret = ((x<<y)&0xFFFFFFFF)|((x>>(32-y))&0xFFFFFFFF) #print 'rol32', hex(x), hex(y), hex(ret) return ret def sub32(x, y): ret = (x & 0xFFFFFFFF) - (y & 0xFFFFFFFF) if ret < 0: ret += 0x100000000 #print 'sub32', hex(x), hex(y), hex(ret) return ret def mul32...

Many hash iterations: append salt every time?

I have used unsalted md5/sha1 for long time, but as this method isn't really secure (and is getting even less secure as time goes by) I decided to switch to a salted sha512. Furthermore I want to slow the generation of the hash down by using many iterations (e.g. 100). My question is whether I should append the salt on every iteration o...

What factors do I need to consider to determine whether I should "trust the defaults" with respect to encryption

Background With respect to cryptography in general, the following advice is so common that it may even be platform and language-agnostic. Cryptography is an incredibly complex subject which developers should leave to security experts` I understand and agree with the reasoning behind this statement, and therefore follow the advice when...

MS CSP: Difference between AT_SIGNATURE and RSA_KEY_SIGN (and also AT_KEYEXCHANGE and CALG_RSA_KEYX)

I'm writing CSP library (for CryptoAPI) for smartcards my company sells. I have question about difference between AT_SIGNATURE key type and CALG_RSA_SIGN algorithm for private key (the same also for AT_KEYEXCHANGE and CALG_RSA_KEYX). I know what is written on MSDN site, but how specifically CSP DLL should work if either of CALG_RSA......

Authenticating a user over HTTP (instead of HTTPS)

INITIAL NOTE: This is just for a personal tinkering project; I'm not writing enterprise security here, and if I were, I'd know better than to try to write my own scheme. :-D EDIT: To stress the above point, I tried to tag this under "iKnowThisWouldBeABadIdeaInRealLife", but SO wouldn't accept it because it was >25 chars. Just be aware...

query string parameter obfuscation

I want to obfuscate one query string parameter in ASP.NET. The site will have a high volume of request, so the algorithm shouldn't be too slow. My problem is that all the algorithms I found result in unwanted characters (like +/=) Here is an example of what i want to achieve: www.domain.com/?id=1844 to www.domain.com/?id=3GQ5DTL3...

AES in javascript that matches PHP's mcrypt

Is there any javascript libs that lets you encrypt and decrypt 256 bit AES the way you do it with mcrypt in PHP (and get the same result of course)? I want to give it a variable-length message and a 32 chars key. All libs i find wants fixed-length blocks of cleartext and byte-arrays of keys... This is how it's done in php: $iv_size = m...

How to store the keys generated by DSACryptoServiceProvider?

As explained in the MSDN, it is possible to generate new public/private keys by calling the method DSACryptoServiceProvider.ExportParameters. The result of this method is of type DSAParameters. What is the de facto standard on dealing with these keys? Should I generate new keys for each transaction or should I generate keys once, store ...

How to prevent a man-in-the-middle attack in case of a compromised server?

Imagine that a server is serving public keys of the users to their partners to make encrypted communication possible. However, the server does NOT have access to the private keys.. Anyway - imagine the server is hacked and it sends not the requested public keys: Alice requests Bob's public key Server sends Eve's public key ...

what python package for rsa algorithm

hey crypto experts, looking to do RSA encryption on a short string in python. This is for a piece of user data that I want to store without staff (incl myself) being able to see it. The private key will be on a thumbdrive in my safety deposit box for when we get subpoenaed. my question: is there a 'probably correct' python package for ...

How do I send signed emails from C# application?

I need to send signed emails from within my C# .NET application. Which is the easiest way to do this? ...

Problem with Byte Flood Cryptography (C library)

I have a little problem with a C library: Byte Flood Cryptography. ( http://bfcrypt.sourceforge.net ). I would create a program which use both linux sockets and Byte Flood Cryptography (the Byte Flood Cryptography functions are near from those provided from stdio.h, and this, I have understand). I don't know how to 'bind' the two s...

How to make this RSA lib (with en/decryption functionality only(!)) sign something?

Or concrete - I am using this javascript RSA library for the client side code of my experimental project... I would like to be able to sign and verify messages (-> encrypt with private and decrypt with public key) Is there a way to alter the key data in a way that the algorithms for en/decrypting do it with the "reverse" key? I tried t...

Which attacks are possible concerning my security layer concept?

Despite all the advices to use SSL/https/etc. I decided to implement my own security layer on top of http for my application... The concept works as follows: User registers -> a new RSA Keypair is generated the Private Key gets encrypted with AES using the users login Password (which the server doesnt know - it has only the sha256 for a...

How To Start Learn Cryptography With C# ?

hi all , i want to learn about Cryptography theory (basics) and i want to use the algorithms in c# so i need some guides , books , tutorials to get start please help me . thanks ...

Compute a hash from a stream of unknown length in C#

What is the best solution in C# for computing an "on the fly" md5 like hash of a stream of unknown length? Specifically, I want to compute a hash from data received over the network. I know I am done receiving data when the sender terminates the connection, so I don't know the length in advance. [EDIT] - Right now I am using md5, but th...

Isn't it difficult to recognize a successful decryption?

When I hear about methods for breaking encryption algorithms, I notice there is often focused on how to decrypt very rapidly and how to reduce the search space. However, I always wonder how you can recognize a successful decryption, and why this doesn't form a bottleneck. Or is it often assumed that a encrypted/decrypted pair is known? ...

What type of encryption to use for 48-bit to 48-bit?

I've got a bunch of 48-bit (6 byte) values that I need to encrypt symmetrically. The two requirements are: The resulting encrypted value needs to also be 48-bits (6 bytes) long. They key itself can be (and would preferably be) much longer to guard again brute force attacks. The resulting encrypted value needs to be deterministic, i.e. ...

is there a native alternative to mcrypt?

i need to encrypt some data but i guess mcrypt library is not native in php right? is there a secure and native alternative? obs: i created my own solution but the performance wasn't good =/ ...

How secure are hidden authenticity tokens in twitter's oauth clients' web UI ?

Assuming that you already have created an oauth client app in twitter, you can go to http://twitter.com/apps to manage them. When I viewed the source of the HTML pages, I see that they use a hidden form parameter called an authenticity token in their form definitions. <form method="post" id="sign_out_form" action="/sessions/destroy" sty...