-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: MAC verification failed #21
Comments
The original implementation use AES-ECB. The implementation is meant to be
equivalent, except it uses crypto module which probably have better
performance. As you can see I'm on email, but I will update this comment
later with a better explication.
I think MEGA is returning invalid data, like an error, which wasn't handled
properly.
If you think the problem is in the MAC verification try testing again with
the browser version: it still uses the original non-optimized code.
|
I checked the commit history and, sorry, it's messy so I can't show it to explain it better. I will explain the original code and mine:
So both implementations are equivalent in their results, but mine probably have better performance (but it can improved). Also note that there a test checking if this function is working in tonistiigi's and mine repositories. The values tested are the same (with a small difference in the test). As I said before probably the issue is some not handled error. Do you tried the browser version? Other thing you can do is using a sniffer (as, following original implementation, downloading use HTTP) and try to check if MEGA returned an error at some point. Edit: I mistook CTR with CBC. Fixed. |
I tried to build to test with the browser version but rollup is failing with the
Thanks for the quick reply! |
What? Browser versions don't have dependencies: there isn't any "import " in the ES6 version and no "require(" in the UMD version. You configured rollup right? plugin-node-resolve is configured to use Edit - by the way you can load it in browser by using one of the two ways below: <script src="https://unpkg.com/megajs@0.11.2/dist/main.browser-umd.js"></script>
<script type="module">
import * as mega from 'https://unpkg.com/megajs@0.11.2/dist/main.browser-es.js'
window.mega = mega // in order to export it as a global
</script> |
What happened? |
As there's no response I will close this issue. Maybe the problem was caused by #20, so in this case it will be fixed in future. |
I believe there is something wrong here. Probably 25% of the time I get this error when downloading. The original fork doesn't have this issue, I believe because it uses it's own cipher implementation for MAC instead of cryptos
aes-128-ecb
.Error: MAC verification failed
at Stream.end (../node_modules/megajs/dist/main.node-cjs.js:504:33)
The text was updated successfully, but these errors were encountered: