Considering we doesn't to provide the source code to the customer (by any reason) regarding ZendGuard or Ion Cube which is used, i also heard about the HipHop which compiles php codes into java byte codes.
So do you think if it is right solution to use HHVM just compile my codes into byte codes then remove php files and everything work just fine?
I used codeignter which i saw 100% compatibility with HHVM in it's website.
HipHop expects the PHP source. You cannot remove the source files.
It is not a byte code compiler and should not be compared to Java's redistributable bytecode. HipHop is a runtime environment where PHP is JIT accelerated.
PHP is a dynamic typed language, so it's difficult to generate efficient machine code. HipHop observes the execution paths of PHP scripts over a period of time and makes a pretty good guess. You could turn on Authoritative mode, so that the file is read in once, and never expect to be changed. Even so, the JIT needs to be warmed up.
If you want to deliver a bytecode format of PHP, use a OpCache product instead of HHVM. But it's just not the same.
HipHop expects the PHP source. You cannot remove the source files.
It is not a byte code compiler and should not be compared to Java's redistributable bytecode.
You do can tell it to byte code compile PHP files to a SQLite file.
https://github.com/facebook/hhvm/wiki/Running-PHP-programs-with-HHVM#using-repoauthoritative-mode
Related
As far as I know, the compiler compiles the code by converting it to a language that a computer can understand which is the machine language and this is done before running the code.
So, does the compiler compile my code each time I write a character in the file?
And if so, does it check the whole code? Or just the line that updated.
An important part to this question is the type of programming language(PL) we are talking about. Generally speaking, I would categorize PL into 3 groups:
Traditional PLs. Ex: C, C++, Rust
The compiler compiles the code into machine language when you hit the "build" button or the "run" button.
It doesn't compile every time you change the code, but a code linter does continuously observe your code and check it for errors.
Another note, when you change part of the code and compile it, the compiler doesn't recompile everything. It usually only recompile the current assembly file (or module or whatever you call them).
It is also important to note that a lot of modern IDEs, compile when you save the files.
There is also the hot reload feature. It is a smart compiler feature that can swap certain parts of the code while it is running.
Interpreted PLs Ex: python, JS and PHP
Those languages never get compiled; Rather, they get interpreted or translated into native code on the fly and in-memory when you run them.
Those languages usually employee a cache to accelerate the subsequent code execution.
Intermediary Code PL. Ex: Kotlin, java, C#
Have 2 stages of compilation:
Build time compilation.
Just in time (run-time) compilation.
Build time compilation converts the code into intermediary language (IL) machine code, which is special to the run-time.
This code only understood by the run time like Java runtime or dot net runtime
The second compilation happens when the programs get installed or ran for the first time. This is called just in time compilation (JIT)
The run-time convert the code into native code specific to the run-time OS.
https://webassembly.studio/ allows inspection of WebAssembly (WASM) files and the corresponding SpiderMonkey-generated x86 code. I'd like to similarly inspect instructions generated by V8's WASM compilers (Liftoff and TurboFan).
I'm entirely unfamiliar with V8's codebase/API (I compiled & linked it and followed some tutorials, though). There seems to be a v8::CompiledWasmModule class available, but it does not seem to expose access to generated x86/x64 instructions by either Liftoff or TurboFan.
WebAssembly - adding a new opcode describes the process of adding a WASM opcode to V8. Seemingly appropriate functions for WASM compilation/execution are available in the mentioned classes. Though, these seem rather deeply layered within the V8 codebase and would be difficult to access were I to link V8 as a library. Also, I'm unsure if this corresponds to Liftoff or TurboFan.
Could anybody familiar with the V8 codebase give me some pointers as to how I can access Liftoff and/or TurboFan's WebAssembly compilation module, as to obtain x86/x64 code?
To inspect generated code, you can run the d8 shell with the --print-wasm-code flag. You'll need either a debug build, or a release build with the v8_enable_disassembler = true GN arg.
There's no existing way to retrieve generated code via V8's API; so if that's what you want, then you'd have to add it. Keep in mind that V8 is not designed to be a standalone compiler, which means generated code assumes that it's going to run "inside V8", so if you wanted to use it for anything else, you'd have to make significant modifications.
I've been writing a Python extension use the Python/C API to read data out of a .ROOT file and store it in a list of custom objects. The extension itself works just fine, however when I tried to use it on a different machine I ran into some problems.
The code depends upon several libraries written for the ROOT data manipulation program. The compiler is linking these libraries dynamically, which means I cannot use my extension on a machine that does not have ROOT installed.
Is there a set of flags that I can add to my compilation commands to make these libraries statically linked? Obviously this would make the file size much larger but that isn't much of an issue providing that the code runs at the same speed.
I did think about collating all of the ROOT libraries that I need into an 'archive' file. I'm not too familiar with this so I don't know if that's a good idea or not.
Any advice would be great, I've never really dealt with the static/dynamic library issue before.
Thanks, Sean.
Actually, I'm a PHP developer. I want to sell my PHP product.
So, I want to protect some major source code in PHP. But it's impossible in PHP.
I know Golang also. So, I want to to build secret algorithm in golang code and compile into binary.
Finally I want to protect my PHP major algorithm with PHP code && binary program.
My doubt is:
When I'm compiling golang source code into binary file.
Is it possible to grab golang source code from binary file ?
No, if they really really want to, they can disassemble the binary and guess what the algorithm does from the assembly, this however, applies to all languages.
If it runs, it can be disassembled and it can be broken.
There are 3 things you can do to protect your code.
You can, of course, obfuscate all the code prior to a build.
I dont knwo of any specific golang tools to do this.
Stripping symbols
But i worry about a "gifted hacker" who will decompile and try to steal my work. It has happened a few times already.
So, you want something whereby the "hacker" is defeated as it's too much work to try and re-assemble.
Stripping the symbols should be more than enough.
You can omit debug information passing the '-w' flag to the linker, and you can omit the symbol table by passing '-s'.
See go tool link in 1.5 here:
https://golang.org/cmd/link/
Device Fingerprinting
This ensures your software cannot run unless its on the same machine when the license was generated for it.
The license is stored on your server, and the fingerprint meta data is sent and check.
You can see this in action here:
https://github.com/hashicorp/nomad/blob/master/client/client.go#L147
Note that in their code they are NOT generating a license against the fingerprint. This is something you would want to do as extra. You can also hash it and sign it and other fancy stuff, but thats too much detail for this post.
Of course a "hacker" can get around this IF they can decompile your code, but as i mentioned in Step 2, this can be defeated pretty well by stripping the symbols.
Obfuscation, as in step 2 helps, but most decent coders can find the place where the code is doing a check and just comment out the check and recompile.
But with no symbols its almost impossible to recompile.
Hope that helps ...
In our project, we are building an ELF file and a partially linked file (PLF) which is converted to a proprietary format and loaded into memory after the ELF is loaded. We use Codewarrior to run and debug, which has been working just fine (the C++ source code is always available to step through when debugging).
I've recently made a change where some code and data are compiled into a different section in the PLF file (.init, which was previously empty). Now, when debugging, a majority of the files are available only in assembler. When I re-build, no longer using .init, we can step through C++ source code again.
Does anyone know why this would be the case?
why this would be the case
One reason could be that codewarrior is not expecting to find code in .init section.
You are unlikely to get a good answer here. Try codewarrior support forums.
I got this working by switching the order of the sections using the linker command file (.lcf) so that the .init section comes second after .text. I guess as Employed Russian suggests, CodeWarrior is surprised by having code in .init and craps out. Changing the order of the sections seems to have no ill effects and now debugging works as expected again.