Nitgen DX Hamster模板转TopData考勤机兼容格式咨询
Hey there, let's tackle this biometric template conversion problem between your Nitgen DX Hamster reader and the TopData Inner rep Plus time clock. I've broken down the key details and actionable steps below:
- Your goal: Convert biometric templates from the Nitgen DX Hamster reader into the specific hex format accepted by the TopData Inner rep Plus time clock
- Time clock requirements: A fixed 808-character hex string, starting with the exact prefix
00000003, followed by template content - Reader outputs two raw template formats: Byte array (represented as a string) and a formatted string template
000000033cbcc6b7800355c085a0f211f14cfeb0c802296dc50f6358398c9aa0081483c8116b38dc23d3064b52f111329b9bfa4ec63c3a32c761e7b1da7dce79b1e40da2395fb7f414befaece7d3c9393de23d02f914b6b5f08514faeca803aabee835a1cd1debaee503d689ebabf72f4f1a31260c3af461d4ca0077750841c4fff0cff300661e4a63613627138a0b5fb9cb25f6f2a94503228f0f371566f506c07e4c4d2a4b5ab983d63e22cd8c3b18af44ab6b9f217599729d3d8bce9a89f6eef01a42407c9f2039d40388724581702cc1afff8f1204250dc99065c26f489c3c59ed51cb2a3272dd90d6dd8603535357303a441fdc30604fdf3fa2451d7c733aa0d186d67af811b444c66b8ea9f49281c66bb7525960fd82c1dc87307dd4a6d412d47210d44f027431f5c67da522eff84f89752cc361aeb2e5980a4f3d399143cd90cd2bf3b6a4867d884000fa97d7dc58aad9b993aafff0d3e787d762f04cb6d6e675137bf44d263e0cab4c9f27130ef3010471555ffde48e4e3972551591f7f967dc7dc04c98eb9a4fe532b22fa279909826
Byte Array (String Representation)
2321002024688128302362151293211065206136158108172671181342411681581391713105146215237882221051201041962421623466246195110174392551102251161018830821201212363439160391021063778114184853106815722111311193225991152521911148117449150240249171218659719221452184130150236701037219121690229422504918414818011217110310520623213296267010494142611761181454254241686725011764185224166332071995620191743539159188172181103221919168202170118255809911523584541741841101871713633662531252234119022738597417820214305824222112512502161825116121321813811515111713317317920910738802021641891994186190675109886162321548023360255190921610622331105972354710823416320225219211520223138122415015578139152172106216813017514107717015217118213520923723513585164158209207219982552672271272125019710537161472022412413011313526112009381335622371952081915534174107605749145562011553663148851451172488459222228142231204243121163186255200485920219224523277195981585312522818422361971151949413614748321412352342506836219220321414997361444914124720715747121102174811618824825213825025319320415315113913020051941902187321841601620818241243217231209208101062151882102201738715412515986971811464563806122721314023716815225272081812132062175962728379168217341971102260202160208451162921649149282081992182332231402291122391681319724169
Formatted String Template
AQAAABQAAAD0AQAAAQASAAMAZAAAAAAA6AEAAMfj53h2ljjbpA1OySQbu/FTD3fAM4RTLStGw3RZuIsf6jZ6A5ChCMjEf22dlmOflpIXNKDEhf91gYI4M9Gs4M22OJbh2rV5edOQVplBnzmTnW1my8u1Ad0oQjtEA*AcwRjk7nhPtQGE402aHJ0S9ocX5R0Qq5reXyNskmvbIN8UQ92URD*bcpKUClXRiR/GPPso2PHDGA7V*KzFjcQaIC1MpAUU/qRUtHsUES87hyOEbZK9v25dkD0s9vU9D0Nzxj4D4h7BWCieRkD4YB3TzwujGR8*A9OaJsKXSIs5RGtxqgCwoN4SREQ31E/yvBrXcU0R/KOAqU4N0pGJGIlgCKHmHoVHmzcxg35WjJG6VZaKmBvvwSjrIeQM*0aHs39Cw4sc7zIalHbTUNSJOwC8lHRll5zNVWIdzoqch0vPSuvmvoZpXPZnle7qXuDVKbwYqE6NQOBYgg3F4tmcwwb9RLDvhPBTRnzrx/WX*iJSy4tnHL4UrhGG4u1vuC4OfI3j6Sbkv6DalbBQhIvJ3Mfak/3mWfnlhIhbcDkJoFrHDsl3DrEonTVwmyuU02TZhxEzVyAhQYqmGv3tMUwYmTYindiHUnpv2yf9hrB0M8rhFWIqGAK5wSxCYOxfL6cjenueu3J0t9M3MpOSHiShrgKHGHI
VB Conversion Function
Private ConvertedBytes As String Public Function ConvertBytesToHexadecimal(UnconvertedBytes As Byte()) As String For x = 0 To UBound(UnconvertedBytes) - 1 ConvertedBytes += Hex(UnconvertedBytes(x)) Next Return ConvertedBytes End Function
Converted Hex Result
DC1001664341329E9BDA156032D62CDA62C9097E6A467973C96CD593FF35D9E42AD4EB079428D895891F740557EE7C460BBB13A5CB54950A14826B99C4C5A2944A82724E4C9AE349529B37E2923FE4C7D5D1BC3220A997107C35181FBB94CC8157DC8BCDE4736F9CC13C15B3D9DBAB104DCEF64FEDADDDC4C3E4F8B68A4D3C3AED6D2199EB7159042C0557E98B1034B54B2719CE3C3857E5403FA677DED9D548349136FC4D212B2CDCE5AD852AFB699FD53EE4E3945F65EDE13CA8FD9724D3489D7BEA223A7A8E73AF8C1CF6FA26CD154A7C33C4785C4D82CE6256F16274D6555B655F146ACE24221CF1BFE0AF899451D1F41ACA4A10D34CD10F3AAEE51320B5AA1FD61097D06F2AACCA1BB4887734ED58041A1A232FBD7F771C4924E59B173B01FF6417F98BD8D5118BCBC579516191B894EA8C112674AF5712B758DECA982A6BB96F5D54423353C157694E3A9B28955E78D825B1585BA05F9CF5BA34C38AC95DD78E7F3A7AB0333F319114A217D26D7D42F6184AA43D740DA791F2C8E79C7EF805F589281948B63D8E64E67BCCDAB9586D97888EE09446224856ABEE41AED12CB5FF6B1E890C3FC3A2FAA08E757079B2989C4DF46A4C47C3846C57ED0547A19B4F1BE87238C1EBC16
Let's break down the steps to adjust your current workflow:
Fix the Hex Conversion Function
Your currentHex()call returns 1-character strings for bytes 0-15 (e.g.,Hex(5)gives"5"instead of"05"), which breaks length consistency. Update the function to ensure every byte converts to a 2-character hex string:Private ConvertedBytes As String Public Function ConvertBytesToHexadecimal(UnconvertedBytes As Byte()) As String ConvertedBytes = "" ' Reset the string to avoid leftover data from previous calls For x = 0 To UBound(UnconvertedBytes) ' Pad with leading zero to ensure 2 characters per byte ConvertedBytes += Right("0" & Hex(UnconvertedBytes(x)), 2) Next Return ConvertedBytes End FunctionNote: I added a reset for
ConvertedBytesto prevent it from appending to previous results if the function is called multiple times.Enforce the Required Prefix
The time clock requires the template to start with00000003. Take the corrected hex string from step 1, then:- Remove any existing prefix (if present)
- Prepend
00000003to the template content
Adjust to Exact 808-Character Length
The total length must be 808 characters. Since the prefix is 8 characters, your template content needs to be exactly 800 characters:- If the corrected hex content is longer than 800 characters, truncate it to the first 800 characters
- If it's shorter than 800 characters, append
0s until it reaches 800 characters - Combine the prefix and adjusted content to get the final 808-character string
Optional: Handle the Formatted String Template
If you prefer to use the reader's formatted string template instead of the byte array:- First, remove all `

