2022 Developer Survey is open! Take survey.
47 votes

How to find modulus from a RSA public key?

I wanted to help break down exactly what you're seeing. If you take your base64 string: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/...
user avatar
  • 903
32 votes

How to find modulus from a RSA public key?

In practice, one can use openssl to extract the information: ...
user avatar
  • 7,904
31 votes
Accepted

Can I remove newlines in a public key?

I'm assuming you mean a base 64 encoded key file, since removing the newlines from a binary file would obviously break things. The RSA standards (e.g. RFC 2459) only define a binary representation for ...
user avatar
  • 31.2k
30 votes
Accepted

How to find the encoding of an RSA public key?

The first step is to check how much data we have. That gives an idea of the size of the public modulus: although it is possible to compress an RSA public modulus $N$ to less bits than its bitlength $\...
user avatar
  • 122k
28 votes
Accepted

How to find modulus from a RSA public key?

RSA key formats are defined in at least RFC 3447 and RFC 5280. The format is based on ASN.1 and includes more than just the raw modulus and exponent. If you decode the base 64 encoded ASN.1, you will ...
user avatar
  • 31.2k
24 votes

Does keyless encryption exist?

Clarification I'm wondering whether there exists an encoding/hashing/encryption scheme whereby the original string can always be derived in its entirety given the entire encoded/hashed/encrypted ...
user avatar
  • 19.2k
23 votes

Encoding vs. Compression vs. Encryption

OK, there seems to be some confusion with regards to terminology, so let's try to clean that up. I'll try and define things myself, but also provide the more formal Wikipedia definitions. Encryption. ...
user avatar
  • 44.6k
15 votes
Accepted

Is there an existing cryptography algorithm / method that both encrypts AND compresses text?

So I'm trying to find a method of encryption that not only obfuscates text, but also compresses the result. For example, if I encrypted ninechars, the ideal ...
user avatar
14 votes
Accepted

Using 32 hexadecimal digits vs ASCII equivalent 16-character password

They are both equal. Passphrase security is based on the amount of entropy that the passphrase contains. In your case, both of your pieces of data are only different in the encoding. The actual ...
user avatar
  • 1,105
14 votes

Does keyless encryption exist?

Secret Sharing may be another option to consider. It allows you to take a value, break it up into arbitrarily many pieces, and possession of a subset of these pieces, not the entire set, makes ...
user avatar
  • 691
13 votes
Accepted

Why do we use hex output for hash functions?

Hexadecimal is traditional -- by this, I mean that there first were command-line tools that used hexadecimal for output, then other people using the hash functions found it fit to stick to hexadecimal,...
user avatar
11 votes
Accepted

How to perform frequency analysis of a substitution cipher using a Base64 alphabet

I'll assume that the plaintext consists entirely of capital ASCII letters as in the example. This implies the high 3 bits of each byte of plaintext are 010. It is ...
user avatar
  • 122k
11 votes

Algorithms for Cyrillic encryption

Modern cryptographic algorithms are specified in terms of bytes or even bits, not characters. Whether the data you encrypt happens to represent latin or cyrillic letters or pictures or audio data or ...
user avatar
  • 10.9k
10 votes

Would it be better to split a file and then encrypt, or vice versa?

Either could be implemented securely, but if you encrypt first and split afterwards, you can use standard tools and get everything right more easily. If you used the opposite order, you would have ...
user avatar
  • 31.2k
9 votes

Is there an existing cryptography algorithm / method that both encrypts AND compresses text?

The way this is usually done is to use a separate compression algorithm, then encrypt the compressed (shorter) message. However, compression has some disadvantages and nowadays its use is discouraged....
user avatar
  • 31.2k
9 votes

Encryption-then-encode or encode-then-encryption?

With some modes you can encode then encrypt, specifically stream cipher modes (CTR, OFB). Bit errors during transmission translate to identical bit errors in the encoded plaintext, and error ...
user avatar
  • 12.6k
9 votes

Does keyless encryption exist?

OAEP - Optimal Asymmetric Encryption Padding may be what you want. In RSA public-key encryption system, in order to prevent partial decryption, OAEP padding is used. In essence, it's a Feistel ...
user avatar
  • 6,551
8 votes

Do I need to worry about timing attacks in Base64 encoding/decoding of private keys?

Yes, kind of. The encoding does depend on the individual bits so there could very well be timing differences. Note that the differences would be pretty small; encoding a byte is likely much faster ...
user avatar
  • 84.7k
8 votes
Accepted

Does character encoding change entropy?

Technically these two strings have the same entropy I believe: We cannot tell how much entropy is in a string by looking at it, as it depends on how it is generated and if the values cannot be ...
user avatar
  • 84.7k
7 votes
Accepted

Are specially designed fonts sometimes used in cryptography?

Is this something that exists and could be plausible? Yes, things like that already exist and have even been used by well-known serial killers! (So much for creating a dramatic intro – lol) ...
user avatar
  • 17.4k
7 votes

What are I2OSP & OS2IP in RSA PKCS#1?

I2OSP and OS2IP mean Integer to Octet Stream Primitive and Octet Stream to Integer Primitive. There is an often used play on words here: "two" (2) has almost the same pronunciation as "...
user avatar
  • 84.7k
7 votes
Accepted

Doubt regarding converting hex to byte in SHA-256 input

Let us consider a simple string in Hex: 2E Its SHA value is: cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8 ...
user avatar
  • 84.7k
6 votes
Accepted

Decoding base64 encoded message with a key

That's a simple substitution cipher. Base 64 uses the following alphabet A-Za-z0-9+/. Here A encodes ...
user avatar
  • 84.7k
6 votes

Encoding a message to a point of curve y^2=x^3+7 and Bitcoin Core

In ECDSA, the message is never encoded as a point in the elliptic curve. Signing in ECDSA loosely works like this: $$ \begin{align*} k &= \text{random}(0, n) \\ (x, \_) &= k \cdot G \\ r &...
user avatar
  • 11.6k
6 votes
Accepted

SHA-1 requires utf-8 and reordering of bytes

Text is supposed to be utf-8 encoded / one character should be 8 bit long. this makes sense, since the same text should always return the same hash, but I couldn't find anything about it in the RFC. ...
user avatar
6 votes

Does keyless encryption exist?

A simple way to achieve this with common algorithms would be to do the following: Choose a random key (key) Encrypt the data using the random key (encrData) Hash the encrypted data (encrHash) Xor ...
user avatar
  • 161
6 votes
Accepted

Is there a consensus on what text encoding to use when hashing a string?

Hashing is done on binary, not text strings. It is the job of the character encoding to say what binary representation a string will have. After you represent the text using a particular encoding, ...
user avatar
  • 12.9k
6 votes

Encrypt-then-MAC with base 64

Generally you would use encrypt-then-MAC before encoding. There is no need to process the expanded ciphertext before encoding, and you may be able to send the message both in binary and ASCII-armored ...
user avatar
  • 84.7k
6 votes
Accepted

Converting raw ECC private key into ASN.1 DER encoded key

ASN.1 is a way of defining structures for data, and DER is a binary encoding of those structures. But they aren't describing any structures by themselves. Saying that something needs to be ASN.1 / DER ...
user avatar
  • 84.7k
5 votes

Base64 for a hash algorithm

If you had an algorithm that used a Base64 conversion as a part of its processing, that would not be considered grounds for disqualifying it as a hash function (be it a cryptographical or ...
user avatar
  • 131k

Only top scored, non community-wiki answers of a minimum length are eligible