OpenSSL Key and IV Padding

OpenSSL is an omnipresent tool when it comes to encryption. While in Java we are used to the native Java implementations of cryptographic primitives, most other languages rely on OpenSSL.

Yesterday I was investigating the encryption used by one open source tool written in C, and two things looked strange: they were using a 192 bit key for AES 256, and they were using a 64-bit IV (initialization vector) instead of the required 128 bits (in fact, it was even a 56-bit IV).

Bulk vs Individual Compression

I'd like to share something very brief and very obvious - that compression works better with large amounts of data. That is, if you have to compress 100 sentences you'd better compress them in bulk rather than once sentence at a time. Let me illustrate that:

Java
 




x
13


 
1
public static void main(String[] args) throws Exception {
2
    List<String> sentences = new ArrayList<>();
3
    for (int i = 0; i < 100; i ++) {
4
        StringBuilder sentence = new StringBuilder();
5
        for (int j = 0; j < 100; j ++) { 
6
          sentence.append(RandomStringUtils.randomAlphabetic(10)).append(" "); 
7
        } 
8
        sentences.add(sentence.toString()); 
9
    } 
10
    byte[] compressed = compress(StringUtils.join(sentences, ". ")); 
11
    System.out.println(compressed.length); 
12
    System.out.println(sentences.stream().collect(Collectors.summingInt(sentence -> compress(sentence).length)));
13
}


The compress method is using commons-compress to easily generate results for multiple compression algorithms:

Thoughts on Facebook’s Libra Cryptocurrency

Facebook announced recently that by 2020, they will roll out Libra — their blockchain-based cryptocurrency. It is, of course, major news, as it has the potential to disrupt the payment and banking sector. If you want to read all the surrounding newsworthy details, you can read the TechCrunch article. I will instead focus on a few observations and thoughts about Libra — from a few perspectives — technical, legal/compliance, and possibly financial.

First, replacing banks, bank transfers, credits cards, payment providers, and ATMs with just your smartphone sounds appealing. Why hasn’t anyone tried to do that so far — well, many have tried, but you can’t just have the technology and move towards gradual adoption. You can’t even do it if you are Facebook. You can, however, do it, if you are Facebook, backed by Visa, Mastercard, Uber, and many, many more big names on the market. So, Facebook got that right — they made a huge coalition that can drive such a drastic change forward.

Multiple Cache Configurations With Caffeine and Spring Boot

Caching is key for the performance of nearly every application. Distributed caching is sometimes needed, but not always. In many cases, a local cache would work just fine, and there’s no need for the overhead and complexity of the distributed cache.

So, in many applications, including plain Spring and Spring Boot, you can use @Cacheable on any method and its result will be cached so that the next time the method is invoked, the cached result is returned.

Technical Innovation vs. Process Innovation

When it comes to tech startups, we often talk about innovation — “digital innovation” (or “technical innovation”) in particular. It has, unfortunately, become a cliche, and now “innovation” is devoid of meaning. I’ve been trying to do some meaningful analysis of the “innovation landscape,” and to classify what is being called “innovation.”

The broad classification I got to is “technical innovation” vs. “process innovation.” In the majority of cases, tech startups are actually process innovations. They get existing technology and try to optimize a real-world process with it. Some examples of these processes would include “communicating with friends online,” “getting in touch with business contacts online,” “getting a taxi online,” “getting a date online,” “ordering food online,” “sharing photos online,” and so on. There is no inherent technical innovation in any of these — they either introduce new (and better) processes, or they optimize existing ones.