2 years, 8 months ago
At a solution of problems of combination theory often there is a need for calculation binomial coefficients. Newton binomial, i.e. decomposition also uses binomial coefficients. For their calculation it is possible to use the formula expressing binomial coefficient through factorials: or to use a recurrent formula: From Newton binomial and a recurrent formula it is clear that binomial coefficients — integral numbers. On this example there was a wish to show that even at a solution of a simple task it is possible to step on a rake.
2 years, 8 months agoI offer you transfer of the diary of Ruy Ueyam (Rui Ueyama), the programmer from Google which it conducted during operating time over implementation of the compiler of language C about three and a half years ago (but published only last December). This diary does not bear any practical advantage and is not the tutorial, but it was very interesting to me to read it, I hope and this history will be pleasant to you too :)
I wrote the C compiler in 40 days which called 8cc. It is the diary written by me at that time. It is possible to look at a code and its history on GitHub.
2 years, 8 months ago
In last article about SecureBoot I very much lacked an opportunity to make the screenshot at the UEFI setup through BIOS Setup, but then helped out the redirection of the text console in a serial port. This excellent solution, but is available it on the few server motherboards, and through it it is possible to receive only character graphics, and it would be desirable to receive this — it and looks more pleasant, and it is not necessary to cut its every time from a terminal window. That's it we will also be engaged in it in this article, and at the same time I will tell what is the DXE driver and how to write, collect and test such independently as keyboard input and an output to the screen in UEFI work how to find it on which it is possible to write files among attached devices of storage how to save something in the file from UEFI and how to adapt some external code on With for work as a part of a firmware. If it is still interesting to you — I wait for you under a cat.
To the surprise did not find articles on Habré on this subject and this article I would like to improve a situation. In it I will try to tell most intelligibly from attacking about Format String Attacks, however with some simplifications. In practice they are rather just permitted, but not really there are a wish to go in cycles in them. Besides, the most resistant, dolistavshy up to the end, in addition to invaluable knowledge the small bonus waits.
2 years, 9 months ago Quite recently the Intel company let out very interesting tool kit for software developers allowing to add protection of a program code against cracking and it is essential to complicate life to hackers of programs. This set includes the obfustsiruyushchy compiler, means for creation of the file of the signature used for check of integrity of the loaded dynamic libraries and also library of functions of check of integrity and additional useful tools. Intel Tamper Protection Toolkit beta can be downloaded absolutely free of charge on the website Intel.
2 years, 9 months ago
Once during an ice cold winter time … exactly a year ago, we had a nontrivial task. There is a screen on electronic ink, there is a MHz processor 16 (yes, in the built-in electronics, especially ultralow energy consumption, also such meet) and at all there is no memory. Well, i.e. kilobytes of 8 RAM and 256 Flash. Kilobytes, Carle. And it is necessary to push several images in these sad kilobytes 800х600 in four shades of gray. Having quickly multiplied in mind 800 on 600 and on 2 bits per pixel we receive 120 thousand bytes. Does not get a little. It is necessary to squeeze.
So we saw a task: "how to squeeze a flat cat"? Why cat? Yes because on cats tested on what to check black-and-white pictures. Not on dollar banknotes.
2 years, 9 months ago
This article — an illustration how bit tricks can be used not only in tasks on interviews, but also at a solution of real tasks. In article the description of one method of fast generation of the courses in the Russian checkers on the basis of magic bitbord (magic bitboard) is given. Bitborda — representation of a position in the form of several unsigned integers which each bit is responsible for a status of some game element, for example cages. Usually use of bitbord gives a prize on performance and on the amount of the used memory, but is connected with more sophisticated programming. At the same time often there is a problem of receipt of value of certain bits in a bitborda, for example, for the subsequent addressing the table. There are two basic approaches to a solution of this task. The first — use and support of excess representation in the form of additional bitbord with renumbering of bits. Such bitborda asto are called rotated. The second method — multiplication by a magic constant, shift and the addressing the table. About such magic bitborda the speech in this article will also go.
Let's allow we have some set which consists of N elements. Let's consider that elements are numbered from zero to N-1. The set of k-element subsets of this set (combinations) can be presented or in the form of an array of indexes of length of k. Or in the form of sequence from N bits in which k from them is set exactly. At Donald Cnut in its TAoCP the algorithm of generation of combinations is given in dictionary order when combinations are set in the form of an array of indexes. We will try to transfer this algorithm to a case of bit masks.
It is a little protection against code injection, but This method not the panacea, but complicates life of injections of a code a little.
Since with each jump of high-level programming less people understand the assembler, that is sense to reflect: And what if the program which you perform is not it? Or, and that if the virus replaces pieces of the program which you use? Smart people in far 80kh thought up one recipe to confirm integrity of executive files and their separate pieces — hashes. Usually all releases of libraries are delivered with a hash or the digital signature whether to check this author delivers to us a liba, or the application whether it was changed by nobody except it. There are languages (With, C ++) which does not support this feature in a rantayma (such as in Oberon in whom there are a few sensible ideas as modules for example), but With is good the fact that with his straight arms it is possible to finish a little a file. At big desire it is also possible to finish About the compiler, but it is other history. Why you should not trust anybody? There are many versions of the answer to this question. Part of them in a comic type.