@AndrewSmith I would argue that C is nonetheless still more universal than PHP. And arguably safer. And definitely better designed. C may give you enough rope, but PHP ties it around your neck.
My favourite quote from one of the other chat rooms: > WTF Google Images, I never asked for a picture of a dolphin lying on the sand with its innards visibly coming out
@tylerl yep - you can secure most languages, but it's the effort trade-off. php is just a pain in the neck to make sure it is secure.
we allow such questions as long as they're about security.
but if it's about breaking copyright protection or cracking commercial apps, then no.
@AviD However, it is possible to measure the security of C code as long as you stick to a certain model. That's how the CLR works in C#.
they have a whole set of mathematical and logical proofs that code produced by the CLR's JIT compiler is type-safe, which ultimately implies that there can be no buffer overflows and such.
doesn't mean the security model built on top of it is safe, but the code is type-safe at least.
cryptography comes from the greek for "hidden secret" and "writing". so it's about making a message impossible to understand or read, even if an attacker is looking right at it.
steganography is about hiding messages such that an attacker wouldn't notice the message is even there.
so steganography is a security-through-obscurity method, but it can be quite useful.
so - the final week of competition now, and the topic is smartphones and mobile devices - anything in these tags: mobile, ios, android, windows-phone and tablets
@Polynomial I don't think that's true anymore. Converting opcodes (in CIL or a concrete CPU, doesn't change a thing) by stringing code snippets obtained from compiling C or C++ code is a viable strategy (that's what QEMU does) but it is limited with regards to optimization.
As far as I know, the recent .NET VM implementations from Microsoft produce native opcodes directly, with local optimizations as a C/C++ compiler would do.
So, possibly, these VM may produce code in an intermediate representation (not CIL, something lower-level) which could be compatible with what Visual C++ produces when translating C++ code -- so that the optimizer back-end could be shared.
There is no guarantee that there is equivalent C++ code, though. If only because the type system of CLI and that of C++ are quite distinct (e.g. C++ has multiple inheritance, CLI has not).
It is possible to make a VM which converts CLI to C code (I have done it with Java bytecode) but that's specialized C code, which is bound to be quite ugly, and interactions with the GC are a bugger.
As I often say, not only does the GC offer safety with regards to dangling pointers, but it also allows efficient handling of immutable character strings, which removes most of the situations where C/C++ programmers commit buffer overruns.
@CodesInChaos A properly tuned GC can improve cache locality by moving objects around in RAM (it requires precise identification of pointers, so as to transparently update them), so it can boost performance.
For the rest, I tend to consider that offering an interface to native code (in C, assembly, whatever) is sufficient for the most time-critical jobs.
@CodesInChaos For rotations, you can use a two-shifts-and-or function, which the (JIT) compiler will recognize -- C compilers have done so for at least a decade, it is not that hard.
@CodesInChaos Java and .NET are not fundamentally hostile to embedded systems, but the core implementations (from Sun/Oracle or Microsoft or Mono) are meant for big PC.
The limitations on 64 bit operations(such as multipyling two 64 bit numbers to and get the high 64 bits of the result) are one of the performance issues that annoyed me most recently.
Reflection implies that the standard classes can all be accessed by names which can be computed at runtime, so it is difficult to safely "prune out" unneeded parts in a given application (unless you control all the code).
If you go the ahead of time compilation route, you need some additional annotations to tell the compiler which parts to keep even if they're apparently unused.
@AviD That's the theory; also, JIT code can theoretically gather runtime statistics on usage which are beyond the grasp of static compilers; but there is a gap between theory and practice.
In practice, what I observe is that, on pure computational cost, JIT code can be as little as 30% slower than equivalent compiled C code, but more often 2 to 3 times slower (mostly because of checks on array bounds)
Also, these JIT compilers happen to produce very fat code, so you can have nasty cache effects. E.g. a RIPEMD-160 implementation which is 50 times slower than equivalent C code, because loop unrolling was overdone a bit and, on the JIT fat code, exceeded L1 cache.
@CodesInChaos In my tests, for hashing, .NET code is similar in performance to Java code (through Oracle's VM) and though it is beaten by C code, it is still fast enough for most purposes.
Even for signatures: I have implemented ECDSA code which can sign 1700 times per second, but then used it in a SOAP-RPC framework with a lot of X.509 thingies around it, which limit rate to 70 signatures per second -- and that is still fast enough !
@CodesInChaos I would say more, that in most applications the last order of magnitude of performance are not measurable, in comparison with the other factors.
@CodesInChaos when would those instructions be relevant (it's been a while since I've delved into that level...) ?
@CodesInChaos even in performance critical code. That does not mean there are not specific scenarios where a specialized language would be more fitting.
@CodesInChaos It is not necessarily time-based. Some people have had success doing numeric computations in Lisp, and Lisp is quite older than C, and still considerably "safer".
More and more of the ones who can are using things like Python. But that's possible only when someone's already done the coding of the tight loops in C or Fortran
@CodesInChaos they're getting there now. It's recent
Aliasing is pervasive in C and invalidates a lot of possible optimizations. Fortran compilers have an easier job when all the code is manipulating big arrays. C compilers how to worry about things like aliasing on the pointer variables
@Gilles I am not sure there is a real, complete C99 implementation out there at all.
C99 does not distinguish between "compiler" and "library". There are compilers which are close to C99 full support, for the parts which are in the "compiler" realm.
@Gilles Comeau claims "full core language C99 support", which is a way of saying "full support except for those parts that we unilaterally decide to be the responsibility of the library developer, whoever this may be and whatever a 'library' can be"
@LucasKauffman be prepared for it to be astonishingly hot (> 40 degrees C) all the time, and for the fact you should not expect to have any alcohol the whole time you are there. Also there may be various strict rules (depending on your environment) on who you can talk to (when working out there, I needed an interpreter for some interviews - not because of the language, but because I needed a female colleague to talk to the women)
Also, they are likely to take Fridays off rather than Saturdays
I've build OpenSSL FIPS container version 2.0.1, then built OpenSSL 1.0.1c using that container (according to the instructions in User Guide for the OpenSSL FIPS Object Module v2.0):
SET FIPSDIR=C:\OpenSSL\FIPS
cd C:\OpenSSL\openssl-fips-2.0.1
ms\do_fips
cd C:\OpenSSL\openssl-1.0.1c
ms\do_nasm...