Visit site The Programming Works

February 2016

0
votes
Vote UpVote

Integer division by constant

The Programming Works – If divisor is fixed, the division operation can be replaced by multiplication by a reciprocal; the idea is very simple: x / d = x * (1/d); since d is fixed we can precompute 1/d and use faster multiplication operation. This trick works for integer division, with some additional complications. For ...
Details Favorite? Off-Topic? Serg @ 2016-02-01 20:45

January 2016

1
vote
Vote UpVote

Serial Number System Challenge

The Programming Works – I stumbled across an interesting link that made me think about a solid serial number system based on strong cryptography. Cryptography discourages systems based on secret algorithms, and relies on open algorithms and secret keys. So let us develop a serial number generation/verification system with ...
Details Favorite? Off-Topic? Serg @ 2016-01-01 10:58

November 2015

2
votes
Vote UpVote

Any CRC algorithm

The Programming Works – TForge 0.73 is released. The theme of the release is implementing any CRC algorithm of size up to 64 bits. New TCRC class implements Rocksoft™ Model of CRC algorithms using one-bit-at-a-time CRC calculation; the details will be published on the related project’s wiki page.
Details Favorite? Off-Topic? Serg @ 2015-11-24 15:01
3
votes
Vote UpVote

Notes on bitwise CRC32

The Programming Works – CRC algorithms calculate remainder from division of a message polynomial by a generator polynomial over GF(2) field. There are many explanations how it works (see wikipedia for example), but there are also practical details omitted that you should care about if you want to obtain an implementation ...
Details Favorite? Off-Topic? Serg @ 2015-11-18 07:42

September 2015

0
votes
Vote UpVote

BigInteger redux

The Programming Works – TForge 0.72 is released. What’s new: Big integer arithmetic is included in TForge package; that is BigCardinal and BigInteger classes are now available after installing TForge package, without dll. Old dll implementation (Numerics 0.58) is still available but is not developed for now. More ...
Details Favorite? Off-Topic? Serg @ 2015-09-10 08:36

August 2015

3
votes
Vote UpVote

More Ciphers

The Programming Works – TForge 0.71 is released. What’s new: TCipher.Salsa20.SetNonce bug fixed added 3DES block cipher algorithm added ChaCha20 stream cipher algorithm Examples of creating new cipher instances: var Cipher: TCipher; begin Cipher:= TCipher.TripleDES; // 3DES Cipher:= TCipher.ChaCha20; ...
Details Favorite? Off-Topic? Serg @ 2015-08-24 07:00
1
vote
Vote UpVote

Salsa20 support explained

The Programming Works – Salsa20 is a stream cipher; like any stream cipher Salsa20 encrypts/decrypts data by xor‘ing a plaintext/ciphertext with a pseudorandom keystream. Salsa20 generates keystream by hashing a 64-byte (512-bit) blocks; the block consists of 4 parts: fixed “magic words” – 16 bytes ...
Details Favorite? Off-Topic? Serg @ 2015-08-08 12:02

July 2015

4
votes
Vote UpVote

TCiphers – Multithreading Support.

The Programming Works – TCiphers supports encryption/decryption in multiple threads for stream ciphers and block ciphers in CTR mode of operation. The idea is simple – to encrypt N bytes of data in m threads you split the data into m parts, each part approximately of N/m bytes size, then create m TCipher instances ...
Details Favorite? Off-Topic? Serg @ 2015-07-30 11:29
4
votes
Vote UpVote

TCiphers

The Programming Works – TForge 0.70 is released. The release adds a new package TCiphers implementing private-key cryptography (block and stream ciphers). The current release supports: Block Ciphers: AES DES RC5 Modes of operation ECB CBC CTR Padding methods No padding Zero padding ANSI X.923 PKCS ISO 10126 ISO/IEC ...
Details Favorite? Off-Topic? Serg @ 2015-07-29 12:58
0
votes
Vote UpVote

Strange overloads

The Programming Works – Combining method overloading with implicit type conversion may lead to strange results. Consider the following innocent stub code for implementing a wrapper type for array of bytes: unit Unit1; interface uses SysUtils; type ByteArray = record class function Copy(const A: ByteArray; I: ...
Details Favorite? Off-Topic? Serg @ 2015-07-27 16:36

June 2015

0
votes
Vote UpVote

Notes on EPR Paradox, Entanglement and Bell’s Inequality

The Programming Works – 1. Elements of reality (aka hidden variables) vs uncertainty. Suppose we have a spin-1/2 particle (ex electron) in the state (fig. 1). Quantum Mechanics (QM) states that if we measure the spin along z direction we get with probability and with probability . There is no way to tell which result ...
Details Favorite? Off-Topic? Serg @ 2015-06-22 11:49

January 2015

3
votes
Vote UpVote

Think twice before raising exception in constructor

The Programming Works – Recently prolific Delphi writer Nick Hodges declared a war on the use of nil pointers. It is arguable whether nil pointers usage is bad or not, but the point is the “Guard Pattern” proposed is really an antipattern. Here is a simple demo: program Project11; {$APPTYPE CONSOLE} uses ...
Details Favorite? Off-Topic? Serg @ 2015-01-21 10:45
0
votes
Vote UpVote

How to get size of adjacent record’s fields correctly?

The Programming Works – Suppose we have two record types TRecA and TRecB declared as shown below; in a sense the TRecB type is ‘inherited’ from TRecA. The goal is to write a general method which clears all TRecB fields which are not ‘inherited’ from TRecA. The code below propose 3 candidate ...
Details Favorite? Off-Topic? Serg @ 2015-01-03 13:51

December 2014

0
votes
Vote UpVote

Endianness issue

The Programming Works – TForge 0.68 is released. TForge 0.68 is a maintenance release which fixes memory leak in THMAC implementation, fixes endianness issue for non-crypto hash functions such as CRC32 and adds minor improvements to ByteArray type. Previous releases were returning message digest values for non-crypto hash ...
Details Favorite? Off-Topic? Serg @ 2014-12-27 10:49

November 2014

2
votes
Vote UpVote

Dabbling in BASM

The Programming Works – TForge 0.67 adds SHA-256 algorithm BASM optimization (applies also to SHA-224 which is based on SHA-256). Now the library contains BASM-optimized implementations of MD5, SHA1, SHA224 and SHA256 algorithms for Win32 and Win64 platforms. Here are some benchmarks; I measured the time required to hash ...
Details Favorite? Off-Topic? Serg @ 2014-11-03 11:25
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)