{"action":"created","issue":{"url":"https://api.github.com/repos/NicolasDorier/NBitcoin/issues/82","labels_url":"https://api.github.com/repos/NicolasDorier/NBitcoin/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/NicolasDorier/NBitcoin/issues/82/comments","events_url":"https://api.github.com/repos/NicolasDorier/NBitcoin/issues/82/events","html_url":"https://github.com/NicolasDorier/NBitcoin/pull/82","id":83859945,"number":82,"title":"Change encoders and uint128/256","user":{"login":"lontivero","id":127973,"avatar_url":"https://avatars.githubusercontent.com/u/127973?v=3","gravatar_id":"","url":"https://api.github.com/users/lontivero","html_url":"https://github.com/lontivero","followers_url":"https://api.github.com/users/lontivero/followers","following_url":"https://api.github.com/users/lontivero/following{/other_user}","gists_url":"https://api.github.com/users/lontivero/gists{/gist_id}","starred_url":"https://api.github.com/users/lontivero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lontivero/subscriptions","organizations_url":"https://api.github.com/users/lontivero/orgs","repos_url":"https://api.github.com/users/lontivero/repos","events_url":"https://api.github.com/users/lontivero/events{/privacy}","received_events_url":"https://api.github.com/users/lontivero/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-02T05:58:23Z","updated_at":"2015-06-02T22:16:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/NicolasDorier/NBitcoin/pulls/82","html_url":"https://github.com/NicolasDorier/NBitcoin/pull/82","diff_url":"https://github.com/NicolasDorier/NBitcoin/pull/82.diff","patch_url":"https://github.com/NicolasDorier/NBitcoin/pull/82.patch"},"body":"@NicolasDorier, this PR contains changes in:\r\n\r\n## Encoders\r\n\r\n* EncodeData method signature changed. Basically, every time we deal with arrays we can see the same pattern all around the .NET libraries: (byte[] data, int offset, int count). That pattern is correct and flexible.\r\n \r\n```\r\nstring EncodeData(byte[] data, int length)  // old version\r\nstring EncodeData(byte[] data, int offset, int count) // new version\r\n```\r\n\r\n### ASCIIEncoder \r\n\r\nNew implementation uses the .NET _Encoding.ASCII_ class ( _GetString_ / _GetBytes_ methods)\r\n\r\n### Base58Encoder\r\n\r\nNew implementation uses _Buffer.BlockCopy_ to manipulate (extract/concat) arrays of bytes instead of Linq. I performed a simple test and the improvement in performance is good (31ms encoding 10 arrays[40])\r\n\r\n###   Base64Encoder\r\n\r\nTiny change (only the method signature)\r\n\r\n### HexEncoder\r\n\r\nI simplified the encoding code using a lookup table what made it easier to understand/mantain and it performs very well. I didn't measured it. However, given it uses a lookup table, it should perform better than the previous algorithm.\r\n\r\n## unit128 / uint256\r\n\r\nI refactored them in order to eliminate duplicated code. Also, all byte-per-byte operations were replaced by uint32 operations (simplicity and performance). As a result, these classes are ~50% smaller than before.\r\n\r\n## Others\r\n\r\n* I fixed a broken test. It wasn't failing but it wasn't really testing neither.  \r\n\r\n## Tests\r\n\r\nAll existing tests are green."},"comment":{"url":"https://api.github.com/repos/NicolasDorier/NBitcoin/issues/comments/108114562","html_url":"https://github.com/NicolasDorier/NBitcoin/pull/82#issuecomment-108114562","issue_url":"https://api.github.com/repos/NicolasDorier/NBitcoin/issues/82","id":108114562,"user":{"login":"NicolasDorier","id":3020646,"avatar_url":"https://avatars.githubusercontent.com/u/3020646?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolasDorier","html_url":"https://github.com/NicolasDorier","followers_url":"https://api.github.com/users/NicolasDorier/followers","following_url":"https://api.github.com/users/NicolasDorier/following{/other_user}","gists_url":"https://api.github.com/users/NicolasDorier/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasDorier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasDorier/subscriptions","organizations_url":"https://api.github.com/users/NicolasDorier/orgs","repos_url":"https://api.github.com/users/NicolasDorier/repos","events_url":"https://api.github.com/users/NicolasDorier/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasDorier/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T22:16:43Z","updated_at":"2015-06-02T22:16:43Z","body":"for the StringBuilder part ? you can do it, but I am very sure about what I am saying."}}