久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <small id='z447Q'></small><noframes id='z447Q'>

    1. <legend id='z447Q'><style id='z447Q'><dir id='z447Q'><q id='z447Q'></q></dir></style></legend>
      <i id='z447Q'><tr id='z447Q'><dt id='z447Q'><q id='z447Q'><span id='z447Q'><b id='z447Q'><form id='z447Q'><ins id='z447Q'></ins><ul id='z447Q'></ul><sub id='z447Q'></sub></form><legend id='z447Q'></legend><bdo id='z447Q'><pre id='z447Q'><center id='z447Q'></center></pre></bdo></b><th id='z447Q'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='z447Q'><tfoot id='z447Q'></tfoot><dl id='z447Q'><fieldset id='z447Q'></fieldset></dl></div>
      • <bdo id='z447Q'></bdo><ul id='z447Q'></ul>

        <tfoot id='z447Q'></tfoot>

      1. 閱讀 Mifare Classic 會(huì)返回奇怪的字符

        Reading Mifare Classic returns strange characters(閱讀 Mifare Classic 會(huì)返回奇怪的字符)

          <legend id='kBNwz'><style id='kBNwz'><dir id='kBNwz'><q id='kBNwz'></q></dir></style></legend>

          • <i id='kBNwz'><tr id='kBNwz'><dt id='kBNwz'><q id='kBNwz'><span id='kBNwz'><b id='kBNwz'><form id='kBNwz'><ins id='kBNwz'></ins><ul id='kBNwz'></ul><sub id='kBNwz'></sub></form><legend id='kBNwz'></legend><bdo id='kBNwz'><pre id='kBNwz'><center id='kBNwz'></center></pre></bdo></b><th id='kBNwz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kBNwz'><tfoot id='kBNwz'></tfoot><dl id='kBNwz'><fieldset id='kBNwz'></fieldset></dl></div>
            <tfoot id='kBNwz'></tfoot>

              <bdo id='kBNwz'></bdo><ul id='kBNwz'></ul>

                <small id='kBNwz'></small><noframes id='kBNwz'>

                  <tbody id='kBNwz'></tbody>
                1. 本文介紹了閱讀 Mifare Classic 會(huì)返回奇怪的字符的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  在使用 Android 讀取 MIFARE 卡并將數(shù)據(jù)轉(zhuǎn)換為 UTF-8 時(shí),我得到了奇怪的字符,例如 .我正在嘗試構(gòu)建一個(gè)可以讀取我們正在使用的某種身份證的應(yīng)用程序.現(xiàn)在的問(wèn)題是我在單詞之間得到了奇怪的字符,并且一些單詞在塊之間被分割了,所以我怎樣才能安全地得到我正在尋找的單詞?例如我的讀數(shù)是這樣的:

                  43224 19032019在第 2 區(qū)塊 sektor 2 bindex :8

                  并在以 19 開(kāi)頭的其余數(shù)字位于新塊的位置進(jìn)行拆分:

                  ...我的名字...M...19

                  在區(qū)塊 1 sektor 1 bindex :4

                  930402...NO934951

                  在第 2 區(qū)塊 sektor 1 bindex :4

                  <上一頁(yè)>c5 42 4e 49 44 00 07 4f 4f 4f 4f 4f 4f 00 4b 42 "?bnid" "OOOOOO" "KB"44 44 44 20 44 44 44 44 44 00 82 4d 00 c9 31 39 "DDD DDDDD" "M" "19"39 34 34 33 34 32 00 d0 4e 4f 39 36 36 36 35 31 "944342" "NO966651"00 00 00 00 00 00 70 f7 88 00 00 00 00 00 00 0030 32 32 20 20 41 53 00 d3 54 4f 54 41 4c 20 4b 022" AS" 總 k"4f 4e 54 52 4f 4c 4c 20 41 53 20 00 c9 30 32 38 "ONTROLL AS" "028"37 30 34 33 33 00 c9 32 30 32 31 30 32 31 31 00 "70433" "20210211"00 00 00 00 00 00 70 f7 88 00 00 00 00 00 00 00

                  這是我從卡片中讀取的方式:

                  標(biāo)簽 tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);MifareClassic mfc = MifareClassic.get(tagFromIntent);

                  這是我用于在 for 循環(huán)中讀取的代碼:

                   data = mfc.readBlock(bIndex + block);

                  然后我使用將數(shù)據(jù)轉(zhuǎn)換為 UTF8 進(jìn)行打印:

                   public String convertByteArrayToUTF8(byte[] bytes){字符串編碼 = null;嘗試 {編碼 = 新字符串(字節(jié),StandardCharsets.UTF_8);}捕獲(異常 e){編碼=新字符串(字節(jié),Charset.defaultCharset());}返回編碼;}

                  我嘗試過(guò)使用 ASCII、UTF-16 等,但沒(méi)有成功.

                  解決方案

                  所以你標(biāo)簽上的數(shù)據(jù)(不包括扇區(qū)預(yù)告片看起來(lái)有點(diǎn)像:

                  <上一頁(yè)>C5 42 4E 49 44 00 07 4F 4F 4F 4F 4F 4F 00 4B 42 ?BNID..OOOOOO.KB44 44 44 20 44 44 44 44 44 00 82 4D 00 C9 31 39 DDD DDDDD.,M.é1939 34 34 33 34 32 00 D0 4E 4F 39 36 36 36 35 31 944342.DNO96665130 32 32 20 20 41 53 00 D3 54 4F 54 41 4C 20 4B 022 AS.óTOTAL K4F 4E 54 52 4F 4C 4C 20 41 53 20 00 C9 30 32 38 ONTROLL AS .é02837 30 34 33 33 00 C9 32 30 32 31 30 32 31 31 00 70433.é20210211.

                  這似乎是某種形式的結(jié)構(gòu)化數(shù)據(jù).簡(jiǎn)單地將整個(gè)二進(jìn)制 blob 轉(zhuǎn)換為 UTF-8(或 ASCII)編碼的字符串沒(méi)有多大意義.相反,您需要對(duì)數(shù)據(jù)的結(jié)構(gòu)方式進(jìn)行逆向工程(或者,更好的是,您嘗試從系統(tǒng)制造商處獲取規(guī)范).

                  據(jù)我所見(jiàn),該數(shù)據(jù)似乎由多個(gè)以空字符結(jié)尾的字符串組成,這些字符串嵌入到某種緊湊的 (Tag)-Length-Value 格式中.第一個(gè)字節(jié)似乎是標(biāo)簽(?)+長(zhǎng)度,所以我們有

                  <上一頁(yè)>C5 長(zhǎng)度 = 542 4E 49 44 00 BNID"07 長(zhǎng)度 = 74F 4F 4F 4F 4F 4F 00 OOOOOO"4B 長(zhǎng)度 = 1142 44 44 44 20 44 44 44 44 44 00 KBDDD DDDDD"82 長(zhǎng)度 = 24D 00M"C9 長(zhǎng)度 = 931 39 39 34 34 33 34 32 00 19944342"D0 長(zhǎng)度 = 164E 4F 39 36 36 36 35 31 30 32 32 20 20 41 53 00 NO966651022 AS"D3 長(zhǎng)度 = 1954 4F 54 41 4C 20 4B 4F 4E 54 52 4F 4C 4C 20 41 53 20 00 TOTAL KONTROLL AS"C9 長(zhǎng)度 = 930 32 38 37 30 34 33 33 00 02870433"C9 長(zhǎng)度 = 932 30 32 31 30 32 31 31 00 20210211"

                  例如,第一個(gè)字節(jié)可以分成標(biāo)簽和長(zhǎng)度,如下所示:TTTL LLLL(高 3 位編碼標(biāo)簽,低 5 位編碼后續(xù)值的長(zhǎng)度).這將給出以下標(biāo)簽

                  • 0x6 表示BNID"、19944342"、NO966651022 AS"、TOTAL KONTROLL AS"、02870433"和20210211"
                  • 0x0 表示OOOOOO"
                  • 0x2 表示KBDDD DDDDD"
                  • 0x4 代表M"

                  因此,標(biāo)簽和長(zhǎng)度之間的分割也可能是 TTLL ??LLLL(高 2 位編碼標(biāo)簽,低 6 位編碼后面值的長(zhǎng)度).

                  不幸的是,該格式與我所知道的任何流行格式都不相似.因此,您可以通過(guò)比較多張不同的卡片并從值中獲取含義來(lái)繼續(xù)您的逆向工程.

                  到目前為止,為了解碼上述內(nèi)容,您將從讀取第一個(gè)字節(jié)開(kāi)始,從該字節(jié)中提取長(zhǎng)度,剪切后續(xù)字節(jié)的數(shù)量并將它們轉(zhuǎn)換為字符串(基于您的示例提供,ASCII編碼應(yīng)該做).然后您可以繼續(xù)下一個(gè)字節(jié),從中提取長(zhǎng)度信息,...

                  When reading a MIFARE card with Android and converting the data to UTF-8 I get strange characters like ?. I'm trying to build an application that can read some kind of ID card we're using. The problem now is that I get weird characters between words and some words are split between blocks so how can I safely get a word I'm looking for? For instance my readings is something like this:

                  43224???19032019?? at block 2 sektor 2 bindex :8

                  and with splitting where rest of the number starting with 19 is at a new block:

                  ?me Name???M???19

                  at block 1 sektor 1 bindex :4

                  930402???NO934951

                  at block 2 sektor 1 bindex :4

                  c5 42 4e 49 44 00 07 4f 4f 4f 4f 4f 4f 00 4b 42   "?bnid" "OOOOOO" "KB"
                  44 44 44 20 44 44 44 44 44 00 82 4d 00 c9 31 39   "DDD DDDDD" "M" "19"
                  39 34 34 33 34 32 00 d0 4e 4f 39 36 36 36 35 31   "944342" "NO966651"
                  00 00 00 00 00 00 70 f7 88 00 00 00 00 00 00 00
                  30 32 32 20 20 41 53 00 d3 54 4f 54 41 4c 20 4b   "022" "AS" "Total k"
                  4f 4e 54 52 4f 4c 4c 20 41 53 20 00 c9 30 32 38   "ONTROLL AS" "028"
                  37 30 34 33 33 00 c9 32 30 32 31 30 32 31 31 00   "70433" "20210211"
                  00 00 00 00 00 00 70 f7 88 00 00 00 00 00 00 00
                  

                  This is how I read from the card:

                  Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
                  MifareClassic mfc = MifareClassic.get(tagFromIntent);
                  

                  Here is my code I use for reading inside a for loop:

                   data = mfc.readBlock(bIndex + block); 
                  

                  and then for converting data to UTF8 for printing I use:

                     public String convertByteArrayToUTF8(byte[] bytes){
                      String encoded = null;
                      try {
                          encoded = new String(bytes, StandardCharsets.UTF_8);
                      }
                      catch (Exception e){
                          encoded = new String(bytes, Charset.defaultCharset());
                      }
                      return encoded;
                  }
                  

                  I've tried with ASCII, UTF-16 etc with no luck.

                  解決方案

                  So the data on your tag (excluding the sector trailers looks somewhat like that:

                  C5 42 4E 49 44 00 07 4F 4F 4F 4F 4F 4F 00 4B 42        ?BNID..OOOOOO.KB
                  44 44 44 20 44 44 44 44 44 00 82 4D 00 C9 31 39        DDD DDDDD.?M.é19
                  39 34 34 33 34 32 00 D0 4E 4F 39 36 36 36 35 31        944342.DNO966651
                  30 32 32 20 20 41 53 00 D3 54 4F 54 41 4C 20 4B        022  AS.óTOTAL K
                  4F 4E 54 52 4F 4C 4C 20 41 53 20 00 C9 30 32 38        ONTROLL AS .é028
                  37 30 34 33 33 00 C9 32 30 32 31 30 32 31 31 00        70433.é20210211.
                  

                  This seems to be some form of structured data. Simply converting the whole binary blob into a UTF-8 (or ASCII) encoded string doesn't make much sense. Instead, you will need to reverse engineer the way that the data is structured (or, even better, you try to obtain the specification from the system manufacturer).

                  From what I can see, it looks as if that data consisted of multiple null-terminated strings embedded into some compact (Tag)-Length-Value format. The first byte seems to be the tag(?) + length, so we have

                  C5    Length = 5
                      42 4E 49 44 00                                               "BNID"
                  07    Length = 7
                      4F 4F 4F 4F 4F 4F 00                                         "OOOOOO"
                  4B    Length = 11
                      42 44 44 44 20 44 44 44 44 44 00                             "KBDDD DDDDD"
                  82    Length = 2
                      4D 00                                                        "M"
                  C9    Length = 9
                      31 39 39 34 34 33 34 32 00                                   "19944342"
                  D0    Length = 16
                      4E 4F 39 36 36 36 35 31 30 32 32 20 20 41 53 00              "NO966651022  AS"
                  D3    Length = 19
                      54 4F 54 41 4C 20 4B 4F 4E 54 52 4F 4C 4C 20 41 53 20 00     "TOTAL KONTROLL AS "
                  C9    Length = 9
                      30 32 38 37 30 34 33 33 00                                   "02870433"
                  C9    Length = 9
                      32 30 32 31 30 32 31 31 00                                   "20210211"
                  

                  The first byte could, for instance, be split into tag and length like this: TTTL LLLL (upper 3 bits encode the tag, lower 5 bits encode the length of the following value). This would give the following tags

                  • 0x6 for "BNID", "19944342", "NO966651022 AS", "TOTAL KONTROLL AS ", "02870433", and "20210211"
                  • 0x0 for "OOOOOO"
                  • 0x2 for "KBDDD DDDDD"
                  • 0x4 for "M"

                  Hence, the split between tag and length might also be TTLL LLLL (upper 2 bits encode the tag, lower 6 bits encode the length of the following value).

                  Unfortunately, the format doesn't resemble any of the popular formats that I'm aware of. So you could just continue your reverse engineering by comparing multiple different cards and by deriving meaning from the values.

                  So far, in order to decode the above, you would start by reading the first byte, extract the length from that byte, cut that amount of follow-up bytes and convert them into a string (based on the sample that you provided, ASCII encoding should do). You can then continue with the next byte, extract the length information from it, ...

                  這篇關(guān)于閱讀 Mifare Classic 會(huì)返回奇怪的字符的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當(dāng)前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測(cè)位置提供者?GPS 或網(wǎng)絡(luò)提供商)
                  Get current location during app launch(在應(yīng)用啟動(dòng)期間獲取當(dāng)前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

                  <tfoot id='crGsk'></tfoot>
                        <i id='crGsk'><tr id='crGsk'><dt id='crGsk'><q id='crGsk'><span id='crGsk'><b id='crGsk'><form id='crGsk'><ins id='crGsk'></ins><ul id='crGsk'></ul><sub id='crGsk'></sub></form><legend id='crGsk'></legend><bdo id='crGsk'><pre id='crGsk'><center id='crGsk'></center></pre></bdo></b><th id='crGsk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='crGsk'><tfoot id='crGsk'></tfoot><dl id='crGsk'><fieldset id='crGsk'></fieldset></dl></div>
                      1. <small id='crGsk'></small><noframes id='crGsk'>

                          <bdo id='crGsk'></bdo><ul id='crGsk'></ul>
                              <tbody id='crGsk'></tbody>
                            <legend id='crGsk'><style id='crGsk'><dir id='crGsk'><q id='crGsk'></q></dir></style></legend>

                          • 主站蜘蛛池模板: av免费网站在线观看 | 久久蜜桃av一区二区天堂 | 成人网在线观看 | av毛片| 午夜视频在线免费观看 | 精品久久久久香蕉网 | 国产精品久久九九 | 美女拍拍拍网站 | 日本爱爱 | 中文字幕在线一区 | 91精品国产欧美一区二区 | 久久成人精品 | 噜噜噜噜狠狠狠7777视频 | 免费国产网站 | 亚州毛片 | a级在线免费观看 | 天堂网avav| 日韩中文字幕在线观看 | 狠狠色综合欧美激情 | 日日碰狠狠躁久久躁96avv | 99福利在线观看 | 91高清视频 | 久久精品亚洲欧美日韩精品中文字幕 | 国产精品地址 | 亚洲国产精品一区二区三区 | 成人在线免费电影 | 日韩成人| 成人午夜免费在线视频 | 黑人中文字幕一区二区三区 | 国产在线观看一区二区 | 日韩av在线一区二区 | 精品国产一区二区三区在线观看 | 国产精品美女在线观看 | 日本精品视频一区二区 | 国产精品久久久久一区二区三区 | 亚洲综合色站 | 91在线观看视频 | 18gay男同69亚洲网站 | 国产欧美精品一区二区 | 日韩一区二区在线视频 | 91色视频在线 |