Giter Site home page Giter Site logo

buffertools-php's People

Contributors

afk11 avatar pnx avatar rubensayshi avatar sisou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

buffertools-php's Issues

hex/getHex issue with value 12a05f200 (5e9)

An additional zero is added after hex/getHex operations applied.
I've checked and it looks like it is pack/unpack behavior for the 'H*' format.

The commit with a test to demonstrate the issue: olegabr@56d7bb3

$ ./vendor/bin/phpunit 
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Error:         No code coverage driver is available

........F......................................................  63 / 196 ( 32%)
............................................................... 126 / 196 ( 64%)
............................................................... 189 / 196 ( 96%)
.......                                                         196 / 196 (100%)

Time: 40 ms, Memory: 6.00MB

There was 1 failure:

1) BitWasp\Buffertools\Tests\BufferTest::testSerialize2
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'12a05f200'
+'12a05f2000'

buffertools-php/tests/BufferTest.php:106

FAILURES!
Tests: 196, Assertions: 592, Failures: 1

Skipping bytes & Changing position

Is there currently a way to skip a byte and manually move the position forward and backward? I looked for any skip, rewind or any methods that would allow me to modify the position variable but there doesn't seem to be one.

<?php

(new TemplateFactory())
    ->uint64le()
    ->uint8le() // Reading a byte to skip it
    ->uint64le()
    ->getTemplate()
    ->parse($parser);

This is what I am currently doing to skip a byte but that seems rather weird. Is there any better way skip N bytes?

Immutable? Fixed Size?

Hey @afk11 (and maybe @btcdrak can butt in too :D?)

I just added 8fe7be5 because they were part of your cleanup PR to bitcoin-php but I don't like it xD

Considering we have a Parser for writing stuff, would it maybe make sense to make the Buffer immutable? so prepend and append would return a new instance of Buffer with the result, but not modifying the original instance?

And another is, maybe we could enforce the size that is specified?
much like how zval works in extensions, if there's more data than the size then you won't be able to get it
and we can also use the specified size to zero pad the binary or hex values returned from it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.